I'm working on a custom scanner for educational videos and lectures. I've got a folder of these, organized by nested folders, roughly like:
Physics/
How Things Work/
Lecture 01.mov
Lecture 02.mov
Lecture 03.mov
Lecture 04.mov
MIT Video Lectures/
1 - Introduction.avi
2 - Newton's Laws.avi
3 - Quantum Electrodynamics.avi
Music/
How to Listen to and Understand Great Music/
Lecture 01.mov
Lecture 02.mov
Another music course/
Lecture 01.mov
Lecture 02.mov
My idea was to create a TV Show section where
- the show names would be constructed from the full paths (i.e. "Physics/How Things Work" and "Music/Another music course")
- all video files in the same folder (sorted alphabetically) would be arranged as consecutive episodes in "season one" (i.e. "3 - Quantum Electrodynamics.avi" in "Physics/MIT Video Lectures" is episode 03 with episode name "3 - Quantum Electrodynamics")
I got this far with my custom scanner:
import re, os, os.path, time import Media, VideoFiles, Stackdef Scan(path, files, mediaList, subdirs, language=None, root=None):
VideoFiles.Scan(path, files, mediaList, subdirs, root)
for nr, i in enumerate(files):
name, year = VideoFiles.CleanName(os.path.basename(i))
show = path if path != ‘’ else ‘Root’
tv_show = Media.Episode(show, 1, nr+1, name, year)
tv_show.parts.append(i)
mediaList.append(tv_show)
This works fine at first. All the correct tv_show objects are created and fed to mediaList.
But the end result is not what I wanted. Somehow the scanner still only accepts one tv show per root folder.
All physics videos and all music videos are gathered into one TV show of each kind, and the different "episode 01"s and "episode 02"s from different folders are stacked together.
Instead of two physics shows, I could end up with, say, just one show called "Physics/How Things Work". It will contain four episodes, and the first three of these would each contain two stacked files (one from "How Things Work" and one from "MIT Video Lectures").
It seems some further logic is applied to the gathered data before or after the scanning itself. I've had a look at the Personal Media agent, but I can't see it happening there.
Any ideas or hints for allowing multiple shows per root folder?