Project

General

Profile

Actions

Bug #1231

open

Scanning for videos should be done in the foreground for /media/usb and background for /media/smb.

Added by Hammel 28 days ago. Updated about 17 hours ago.

Status:
In Progress
Priority:
Immediate
Assignee:
Category:
Runtime
Target version:
Start date:
08 Oct 2025
Due date:
% Done:

50%

Estimated time:
Severity:
01 - Critical

Description

Scanning network drivers can take a loooong time. But scanning usb sticks is fast.

Make the scan for usb in the foreground and then background the scan for network drives, updating the video list in the background.
This should not interfere with video playback.


Related issues

Related to VideoFE - Testing #783: Verify inotify is working with VideoFEClosedHammel24 Jul 2020

Actions
Blocked by VideoFE - Bug #1229: VideoFE should save the current playlist item before it starts, then clear it after it ends that video. ClosedHammel05 Oct 2025

Actions
Actions #1

Updated by Hammel 12 days ago

  • Related to Testing #783: Verify inotify is working with VideoFE added
Actions #2

Updated by Hammel 12 days ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

RM #783 verified that inotify support was working in VideoFE. It was, but it is incomplete. It doesn't check if the notification is for a directory being created or deleted.

To make the scanning work better, I need the following features added.
  1. A top level GList that adds smb mount points to scan.
  2. A thread to do background scanning of a specified mount point.
    1. Discovered data is placed in a temporary GList and appened to the main list with a single mutex-wrapped function.
      1. The main list should then be sorted by title (non-kiosk) or filename (kiosk).
    2. After a mount point is scanned, it should update the display unless it's playing a video, in which case the update can come after.
  3. By Mode changes
    1. For Player mode: scan mount points for videolib files only - shouldn't need to scan for directories first.
    2. For Kiosk modes: scan for files of supported types only (the find command is too broad)
  4. For inotify
    1. Identifying a directory added or deleted.
      1. A function for deleting entries from a deleted mount point.
    2. Identifying a file added or deleted.
Actions #3

Updated by Hammel 11 days ago

For Kiosk modes, where we just scan for videos by file extension, we can create sha1sum hashes to uniquely (mostly) identify them with this command:

head -c 2m 15-FerrisBuellersDayOff.mp4 | sha1sum

This could be done in C by linking -lcrypto and using the OpenSSL headers.

Doing this will slow initialization down but we can limit the amount of data we read from each file to some multiple of file system blksize to help that situation.

Actions #4

Updated by Hammel 11 days ago

  • Blocked by Bug #1229: VideoFE should save the current playlist item before it starts, then clear it after it ends that video. added
Actions #5

Updated by Hammel 5 days ago

  • % Done changed from 10 to 30

Kiosks are now updated to scan for supported suffices and make use of a hash to identify the files. This is used to restart a video from the last position played, if possible. Kiosks don't scan the SMB directory so the background scanning is not necessary.

The non-Kiosk systems still need work done on the scanning and might need to add the hash support.

Actions #6

Updated by Hammel 4 days ago

  • % Done changed from 30 to 40

How non-kiosks should work.

  1. getUSBDirs() - like current getDirs() but just for USB and only searches for videolib files.
    1. Identifies both Movie and TV videolib files.
  2. getSMBDirs() - only gets a list of SMB mounts to scan later.
  3. dbLoad
    1. getSMBDirs
    2. getUSBDirs
    3. Load lists from USB dirs
      1. for movieDir,episodeDir master lists
        1. Clear list
        2. foreach usbDir
          1. getDirs(usbDir) - append to appropriate master list
    4. rest of dbLoad is the same
    5. schedule SMB scans for later
  4. scanSMB
    1. for movieDir,episodeDir master lists
      1. foreach smbDir
        1. Clear tmp list
        2. getDirs(smbDir) - append to tmp list
      2. Run the tmp lists and read in the json files in each directory (readDB() - to movieTmpList, episodeTmpList)
      3. Run through each list of video types and generate the required data (genVideo() - from/to movieTmpList, episodeTmpList)
      4. Append tmp lists to master lists
      5. Sort master lists

To search for "videolib" directories under "movies" or "tv", use a find command like this:

find . -path "*movies*/*" -name "videolib"

or

find . -path "*tv*/*" -name "videolib"

The updateDisplay() function can be used to dynamically update the display but only for the GTK List, which calls updatePoster(). That will need to be redesigned. do_drawing() only gets called on expose events per drawing widget. When I switch to pigtk-icontable (see RM #1149) I can have it update the display based on a new list.

Actions #7

Updated by Hammel 3 days ago

A few things about this issue.

  1. I want to code all that's noted above, but not enable it all.
  2. Only USB searches will be enabled in the list. SMBs searches will be performed but the list will not be updated for now (until the UI changes).

It might be worthwhile to add a sidebar that lists mount points and show videos by mount points if I actually enable SMB before the UI is updated. The TAB key can move between Movies/TV/Mounts - currently it just switches between Movies and TV.

Actions #8

Updated by Hammel 1 day ago

  • % Done changed from 40 to 50

All the updates for scanning USB only are done. It needs to be tested to make sure scans work as before.
Need to implement the SMB scanning, but not actually schedule it.

Actions #9

Updated by Hammel about 17 hours ago

Testing on hardware exposed the following problem:

getDirs[db.c:340] INFO Find command: find sda1 -path "*movies*/*" -name find sda1 -path "*movies*/*" -name
getDirs[db.c:340] INFO Find command: find sda1 -path "*tv*/*" -name movies
Two problems here:
  1. When building command for movies, the command is dup'd in the same buffer.
  2. When building command for either type, the path should use uppercase, as in "Movies" or "TV".

These are fixed in the sandbox and need retesting on hardware.

Actions

Also available in: Atom PDF