Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Better ABsolute Scanner (BABS)

Fixes many existing problems with absolute numbering
READ THE FLAMING MANUAL
YOUR MILEAGE MAY VARY
RESULTS NOT TYPICAL
USE AT YOUR OWN RISK
NO WARRANTIES EXPRESS OR IMPLIED
BACK UP YOUR UNIVERSE BEFORE RESCANNING WITH THIS SCANNER

Clear? Good.

The writeup below is from the documentation (pdf) provided in the attached zip file. The document has a lot more information that may be useful, including information on how to install and use BABS.
BABS.zip

I've tested BABS on my anime collection and worked out some subtle issues I found as a result. There are probably a few things I haven't found yet, but I've got some really oddball filenames in a few places. If you find one, I might be inclined to fix it if life isn't too busy.

Big thanks to Raindancing for his absolute scanner, which gave me an important clue I needed to make BABS.

Enjoy.
jmjf

The Problem
I set up Plex Media Server 0.9.3.5 (PMS) on an Ubuntu 10.04 box that is also my NAS so I could stream my media to a Roku box using the Roku channel version 1.4. I haven't been able to find anything else that can do that, so PMS is my solution. I've generally been pleased with the newest versions of PMS and the Roku channel so far. Huge thanks and kudos to everyone who worked on making this work.

There has been one fly in the ointment. I have a lot of series (TV shows) that are absolute numbered. This is common in the land of anime, where both fansubs and the shows themselves rarely number episodes in terms of seasons. You might get variant show names for different seasons, but TVDB doesn't handle that properly. Generally, the Plex Series Scanner (PSS) did an okay job of scanning my stuff in, except series with over 99 episodes, and series with numbers in the name like Galaxy Express 999 and 07-Ghost.

If an absolute numbered series has over 99 episodes, PSS will split it into seasons of 100 episodes. Which wouldn't be so bad, except episode 100 doesn't show up as episode 100, it shows up as episode 00. There was also some hinky stuff going on with metadata or possibly file matching for Season 2+. I didn't explore it too deeply. It was obvious PSS had hosed it up. I hypothesized I could rename everything use SxxExx, but that would be a lot of work and it would make it much harder to track what I had vs. what I didn't have.

I saw the absolute ordering scanner (tweaked, v2, no less) Raindancing posted on the forums (http://forums.plexapp.com/index.php/topic/21625-absolute-order-agent/), but it didn't solve my problems. I also couldn't figure out how to install his agent (a plexapp file) in Linux.

I also had problems with series like Galaxy Express 999 and 07-Ghost. In the case of GE999, I saw one season (Season 9) and one episode (episode 99). Obvious what's going on there, right? 07-Ghost saw one episode. That's right, episode 7. So series with numbers in the name messed up the scanner. I could force the issue by renaming everything use SxxExx, but that would be a lot of work.

Posting on the forum got the usual, "Just name it all SxxExx," response, even though I'd made it clear that wasn't an option. I was further annoyed by the fact that the Plex wiki says Plex supports absolute ordering for series (right there in the Naming Guide, after the SxxExx and date-based naming sections). Well, since it wasn't working, it was time to dust off the little bit of Python I knew and read up on regular expressions (regexs) and figure out how PSS worked. I also looked at the absolute order scanner, which yielded a few valuable clues (thanks again to Raindancing).

The result of all this is a Better Absolute Scanner, or BABS for short. Corny, but I made it work, so I'm entitled to name it what I want. If the Plex guys want to take the ideas from this scanner and incorporate them into the PSS or an official absolute scanner, please do.

This still doesn't fix the fact that the TVDB agent doesn't know how to ask for absolute ordered data. I may get excited about that and see if it's in the Python somewhere and try to fix it too. Now that I know PMS keeps a copy of the base Plug-ins in /usr/lib/plexmediaserver/Resources/Plug-ins, I might be able to fake it out so it won't overwrite any code changes I might make.

What Changed (Short Version)
I added a bunch of print statements you'll only see if you run the scanner from the command line.

If you use a 3 or 4 digit number to designate season (as 1-2 digits) and episode (as 2 digits), this scanner will NOT read your numbers correctly. You'll need to renumber them absolute or SxxExx or put them in a separate section that uses a different scanner.

If you use a tag to designate the episode (e.g., Blah Blah Ep 234), the only tags this scanner will recognize are "ep" and "episode" (not case sensitive) before the episode number. If you were using something else, you'll need to change it to ep, or episode. Based on a quick check of TVDB, this change fixes more problems that it seems likely to create. The tag must be preceded by a separator or be the first thing in the file name.

If you have an absolute numbered series, and the series name is only a number with no words or other characters, BABS will not process an episode with the same number correctly.

For example, if you have a series named "24" and an episode file named "24_24.mkv", the scanner will not pick it up correctly. I recommend you rename the ONE problem episode to something like "24_ep24.mkv" instead.

If your series name has a number in the name, for example, Galaxy Express 999, be sure the containing folder name will match the series name in the file. For example, if the file is Galaxy_Express_999_01.mkv, you should name your folder Galaxy Express 999 or Galaxy_Express_999. If the name is GalaxyExpress999 - 01.mkv, name your folder GalaxyExpress999. CASE SENSITIVE.
BABS.zip 125.4K
«134

Comments

  • elanelan CTO and Co-founder MauiPosts: 9,358Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    So cool to see people making their own scanners :)

    instagram: @elan // the wife's photography site.
    the brother's photography blog // the dog's twitter feed.

  • jmjfjmjf Posts: 63Members ✭✭
    Can a moderator please move this to the new Scanners forum?

    Alternatively, I can repost.

    Thanks.
  • solidfoxsolidfox Posts: 5Members, Plex Pass Plex Pass
    edited November 2011
    This works great! Now my only problem is that tvDB spoils the episodes in its descriptions =P.

    Is there anyway to have certain series actually split into seasons in a Section even though it's scanned by BABS?

    -EDIT-

    So it seems you move the series out of the scanned folder, scan, empty trash. Now you make a folder for each season directly under the main folder for the series. These are to be named on the form Season 1, Season 2 ... Then put the files directly under each season folder, put the series folder back in the scanned folder and rescan.
  • jmjfjmjf Posts: 63Members ✭✭
    edited December 2011
    solidfox wrote:

    This works great! Now my only problem is that tvDB spoils the episodes in its descriptions =P.

    Is there anyway to have certain series actually split into seasons in a Section even though it's scanned by BABS?

    -EDIT-

    So it seems you move the series out of the scanned folder, scan, empty trash. Now you make a folder for each season directly under the main folder for the series. These are to be named on the form Season 1, Season 2 ... Then put the files directly under each season folder, put the series folder back in the scanned folder and rescan.


    The default scanner should handle Season directories. BABS was designed to extend the default scanner to handle absolute order while losing minimal functionality from the default scanner. Both BABS and the default scanner should work fine for me with something like:
    .../ShowName
           Season-01
               ShowName 01.mkv
               ShowName 02.mkv
           Season-02
               ShowName 01.mkv
    


    (I know, the naming guide says to make all those SxxExx under the season directories, but the default scanner handled the above structure fine.)

    If you want absolute order, BABS works best when coupled with an agent that understands absolute order, like AbsTVDB. The default TVDB agent doesn't handle absolute order metadata scanning after the first season (as of 0.9.5). Of course, that's one way to avoid the spoilers for season 2 and after. :)
  • erwinsieerwinsie Posts: 56Members ✭✭
    can i use this on my synology NAS box? Ds1511+
    thanks. im new and i have alot of anime..
  • jmjfjmjf Posts: 63Members ✭✭
    erwinsie wrote:

    can i use this on my synology NAS box? Ds1511+
    thanks. im new and i have alot of anime..


    I haven't tested it on Synology (don't have one), but Synology seems to be running Linux under the covers, so it should work. You'll need to find where Plex's plugins and scanners land on Synology and copy the subdirs into the proper places. If they don't work, you can always remove them--or just leave them. It isn't like they take up a lot of space and a couple of extra subdirs shouldn't break anything. It's all about what you select in the web manager.

    Note thread below where TVDB seems to be having issues right now, so you may have issues.
    http://forums.plexapp.com/index.php/topic/45965-absolute-ordering-how/

    Let us know if this works.
  • AlacardjrAlacardjr Posts: 71Members, Plex Pass Plex Pass
    jmgf love the scanner btw, but got a quick question.... what do you do for the OVA's to show/scan? is there anyway for the OVA to show where the "series" is maybe in a "OVA" folder (as in Season 1, Season 2, OVA's)? or is that a limit of plex it self and nothing can be done to pull that off?
  • jmjfjmjf Posts: 63Members ✭✭

    jmgf love the scanner btw, but got a quick question.... what do you do for the OVA's to show/scan? is there anyway for the OVA to show where the "series" is maybe in a "OVA" folder (as in Season 1, Season 2, OVA's)? or is that a limit of plex it self and nothing can be done to pull that off?


    Sometimes TVDB has absolute numbers for the OVAs or other specials. In that case, I try to number the eps accordingly.
    Sometimes I update TVDB with absolute numbers if they're missing and I have a reliable source for them. (Sometimes I do this with S2-n too.)
    Sometimes I add an S0Exx number to the name based on TVDB's data in Specials. If it's a show where I have season folders, I may create a Season0 folder--or not.

    Plex doesn't care if I have S1 in the series root folder and S2 in a Season02 folder, or if S1 is numbered 1-24 and S2 is numbered S2E01, S2E02, etc. It mixes and matches numbering schemes just fine. My basic philosophy is that I don't want to do massive renumbering, so if I get a show numbered in seasons, I tend to keep it that way, if it get it absolute, I keep it that way (Detective Conan is going to be interesting, though, may have to see if one of the alternate Roku clients will wrap it into manageable chunks), and specials I deal with in whatever way seems to make sense given the rest of the series and how specials fit into the overall flow.
  • erwinsieerwinsie Posts: 56Members ✭✭
    edited September 2012
    hi im new with syno ds1511+ and lg tv.
    i have alot animes and i tried below:
    in plex media server, i added new tv series section and point it to my anime folder.
    on my surprises, plex can scraps all my animes correctly (poster, name, but not some episodes) when i see it on my lg tv (using medialink feature)

    do i still need this babs?
  • jmjfjmjf Posts: 63Members ✭✭
    erwinsie wrote:

    hi im new with syno ds1511+ and lg tv.
    i have alot animes and i tried below:
    in plex media server, i added new tv series section and point it to my anime folder.
    on my surprises, plex can scraps all my animes correctly (poster, name, but not some episodes) when i see it on my lg tv (using medialink feature)

    do i still need this babs?


    If all your episodes are numbered SxxExx or none of your series run more than one season, you probably won't have issues, but if you have series using absolute numbering (e.g., Naruto as episodes 1-220) you might want to check for the issues below. Unless the default series scanner and TVDB metadata agent changed in 0.9.6.8, these problems should still be there.

    For episodes after season 1, the default scanner and metadata agent will not pick up metadata from TVDB. The combination of BABS and AbsTVDB should solve this issue and retrieve whatever metadata is available at TVDB for episodes after season 1.

    You should run into issues with series with numbers in the title, for example see discussion of Galaxy Express 999 mapped and 07 Ghost in the original post.

    If you have series with episodes over 99, as described in the original post (episode 100 becomes Season 1 Episode 00 and episode 101 ends up in season 2, maybe, or maybe messed up, it was unreliable).
  • erwinsieerwinsie Posts: 56Members ✭✭
    jmjf wrote:

    If all your episodes are numbered SxxExx or none of your series run more than one season, you probably won't have issues, but if you have series using absolute numbering (e.g., Naruto as episodes 1-220) you might want to check for the issues below. Unless the default series scanner and TVDB metadata agent changed in 0.9.6.8, these problems should still be there.


    cool. i will try to install on this weekend. i have use filebot to rename all my animes, so far only few are fails: OVA mostly. thanks.
  • jmjfjmjf Posts: 63Members ✭✭
    erwinsie wrote:

    cool. i will try to install on this weekend. i have use filebot to rename all my animes, so far only few are fails: OVA mostly. thanks.


    If you only have a small number of misses, you may find it easier just to rename the episodes. I usually have to change specials to force them to match TVDB, but since they're rare cases, I don't mind. It's different from having to rename all Naruto or all Bleach--or my entire collection, most of which is absolute numbered.
  • luvisluvis Posts: 2Members, Plex Pass Plex Pass
    This is great, now I don't have to rename all my files to s01e02 and so on =) I'ts been a hassle.
    Thanks!
  • erwinsieerwinsie Posts: 56Members ✭✭
    edited September 2012
    luvis wrote:

    This is great, now I don't have to rename all my files to s01e02 and so on =) I'ts been a hassle.
    Thanks!


    try google filebot. its VERY great for auto renaming, finding subtitles, etc. even if you dont need to rename file still good to have filebot. a must for movie/tvshow collectors
  • Moby2kBugMoby2kBug Posts: 16Members, Plex Pass Plex Pass

    Big Thanks for your scanner, it saved me a lot of hassle! Thanks Again!

    Never Argue With An Idiot. He'll Drag You Down To His Level And Then Beat You With Experience.

  • erwinsieerwinsie Posts: 56Members ✭✭

    i tried this but found out, using filebot i can renames all my animes according to tvdb convention numbering system therefore plex picks everything smoothly.

    renaming is not hard, just drag drop fulll folder and then filebot will take care the rest.

    just an option if someone find it hard to follow this wonderful and very useful method from jmjf. cheers

  • biorummetbiorummet Posts: 13Members, Plex Pass Plex Pass
    edited July 2013

    I noticed series that i added didnt show up in my section anymore so i ran pms -s to a file and checked what it wrote out and i found this:

    BABS: Scan
    Error in Python: Running scanner:
    Traceback (most recent call last):
      File "/Users/plex/Library/Application Support/Plex Media Server/Scanners/Series/BABS.py", line 63, in Scan
        VideoFiles.Scan(path, files, mediaList, subdirs)
    TypeError: Scan() takes exactly 5 arguments (4 given)
     
    Seems like they changed something about a month ago, i googled and found this commit https://github.com/plexinc-plugins/Scanners.bundle/commit/505d9db16737307319f47f55778cf7fa46349aa9
    On the bottom of the page u can see changes of Contents/Resources/Series/Plex Series Scanner.py
    I did the same changes to my BABS.py and now its working again :).
     
    Summary:
     
    Change from  
    "-def Scan(path, files, mediaList, subdirs):" to "+def Scan(path, files, mediaList, subdirs, language=None, root=None):"
    and from "VideoFiles.Scan(path, files, mediaList, subdirs)" to "VideoFiles.Scan(path, files, mediaList, subdirs, root)"
  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass
    edited June 2013
    biorummet wrote on June 30 2013, 9:59 AM: »

    I noticed series that i added didnt show up in my section anymore so i ran pms -s to a file and checked what it wrote out and i found this:
     
    BABS: Scan
    Error in Python: Running scanner:
    Traceback (most recent call last):
      File "/Users/plex/Library/Application Support/Plex Media Server/Scanners/Series/BABS.py", line 63, in Scan
        VideoFiles.Scan(path, files, mediaList, subdirs)
    TypeError: Scan() takes exactly 5 arguments (4 given)
     
    Seems like they changed something about a month ago, i googled and found this commit https://github.com/plexinc-plugins/Scanners.bundle/commit/505d9db16737307319f47f55778cf7fa46349aa9
    On the bottom of the page u can see changes of Contents/Resources/Series/Plex Series Scanner.py
    I did the same changes to my BABS.py and now its working again :).
     
    Summary:
     
    Change from "-def Scan(path, files, mediaList, subdirs[/size]):" to "[/size]+def Scan(path, files, mediaList, subdirs[/size], language=None, root=None[/size]):"[/size]
    and from "[/size]VideoFiles.Scan(path, files, mediaList, subdirs[/size])[/size]" to "[/size]VideoFiles.Scan(path, files, mediaList, subdirs[/size], root[/size])[/size]"[/size]

    you sir, are a gentleman and a scholar, i just added a few shows and noticed that not only they showed up but that BABS was failing according to the logs that PMS was throwing and was i looking for this thread to re-download BABS and try to figure out what broke (i couldn't remember where the BABS.py file was at and i remembered it had a PDF with instructions :P)

    for those of you who are too lazy to fix it yourselves, here's a copy of BABS with the fixed listed on biorummet's post, just replace yours with it, restart PMS and you are good to go:
    http://d.desu.es/BABS-fixed-06302013.zip

    Current Library: http://stoleyour.com/plex/ (around 8TB)
    PMS: Mac Mini 5,3 (Mid 2011) | i7 QC @ 2Ghz | 16GB DDR3 | 2x 128GB Samsung 840 Pro SSD's | WS2008R2
    NAS: Drobo 5N | 5x HGST Ultrastar | 14.5TB RAID5 | 1x 64GB Crucial m4 mSATA SSD (Cache) | Firmware 3.1.0

    Clients: 5x iOS 6.0+ Devices | 3x Roku2 XS | 1x HP TouchPad | 3x Laptops (OSX 10.8.X) | 2x Desktops (Windows 7)

  • BrooklynPMSBrooklynPMS Posts: 5Members, Plex Pass Plex Pass

    Thanks for the fix, been trying to figure this out for days.

  • mmccurdymmccurdy The Official Mike M Posts: 841Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee

    Hey guys, sorry for breaking things!  It was a bit of a surprise to me that this scanner and at least one other third party scanner is importing things directly from the official scanner, since the signatures of the methods used internally are not controlled by the Framework or any API, and (as you've discovered) may be subject to change.  They don't tend to change often, of course, but a safer approach would be to maintain the needed functionality in a standalone way without these dependencies.

    Having said that, absolute episode ordering is something that's been requested quite a bit, and I'd like to see if we can do a better job of supporting it in the official scanner.  The issue, as the OP points out, is that there's ambiguity between two fairly popular conventions (i.e. "102" taken to mean "Season 1 Episode 2" and "102" taken to mean "Episode 102").  I don't think it would be wise to modify the existing behavior (in which "102" means "Season 1 Episode 2") across the board, and making this a preference would require a change to core PMS since there's no way to do this in the plug-in right now.

«134
Sign In or Register to comment.