Scanner for educational material (problem with nested folders)

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, Stack

def 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?

0 replies and 0 views, really?

I've taken to keeping a flat folder hierarchy with one show per top folder. That gets rid of most of the trouble.

One annoying problem remains: When one episode is completely viewed, the next one isn't automatically added to "on deck". I had hoped this feature came with media type "TV show" status.

Hints?

(Btw, googling I can see traces of a developer's documentation that now a days redirects to a non-maintained blog. I worry that the Plex team is no longer as interested in hobbyist development, custom agents, scanners and channels ..?)

This would be very useful for a lot of applications. I have all sorts of videos sorted by folders. A customizable scanner in which you are able to tell the scanner in which parental folder or part of the filename a certain piece of metadata is found would give a very flexible solution to handle these kind of old organized videos! 

Guys check out the link in my signature.  In one of the posts I show exactly how to do this.

I use this technique for learning materials and for sports shows like the NFL.

Guys check out the link in my signature.  In one of the posts I show exactly how to do this.

I use this technique for learning materials and for sports shows like the NFL.

Thnx for the post! It's a nice workaround, probably the best there is at the moment. If we were able to give "seasons" a name in stead of a number it would be perfect. I already took a look at te source of the extended personal media scanner and there is a mention of "season name", but after some more digging the conclusion is that Plex won't allow to change it in anything other than numbers or years.

Fevida, save yourself the trouble.  I also went down the same path you are about to take!  SEASONS MUST BE A NUMBER

With some of my sports libraries I wanted to do the following:

\NFL\

  2012\

    Pre-Season 1 (all week up to)

    Superbowl

  2013\

    Pre-Season 1 (all week up to)

    Superbowl

 2014\

    Pre-Season 1 (all week up to)
    Superbowl

Instead I had to do:

  Pre-Season 1

    2012

    2013

    2014

  Week 1

    2012
    2013

    2014

Week 15

    2012
    2013

    2014

Super Bowl

    2012
    2013
    2014

Reason being is the the season HAS TO BE a number and not a name in Plex itself.  The scanner/agent could easily be changed.

So if you can make sure your "seasons" are always number then you can make the "Show Name" pretty much anything else.

So for me and NFL games I just built the libraries so the "show name" was the week and the "season" was the year.  It's backwards from a chronological standpoint but it works and you get used to it pretty quickly.

Any way you cut it, it works and works well with any media types the built in scanners don't work with.  Home Movies, Sporting events, learning, d/led Youtube videos, porn, etc

one tv show per root folder is a plex restriction that can be lifted if everything is added when scan function is launched at root (got the idea from itunes scanner since multiple stuff was added at once)

https://github.com/ZeroQI/Absolute-Series-Scanner/blob/master/Series/Absolute%20Series%20Scanner.py

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.