[PP-Script] VideoSort - better video sorting

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
DoGGY2DoPE
Posts: 1
Joined: 26 Nov 2018, 22:47

Re: [PP-Script] VideoSort - better video sorting

Post by DoGGY2DoPE » 26 Nov 2018, 23:05

I am having an issues with "US" being picked up from the showname (not file / folder name) and being appended as "Us":

VideoSort: MatchesDict([('title', u'tell me a story'), ('country', <Country [US]>), ('season', 1), ('episode', 4), ('format', u'WEBRip'), ('video_codec', u'h264'), ('release_group', u'tbs'), ('container', u'mkv'), ('mimetype', u'video/x-matroska'), ('type', u'episode')])
Mon Nov 26 2018 23:43:45 INFO VideoSort: Using DNZB-ProperName
Mon Nov 26 2018 23:43:45 INFO VideoSort: Using DNZB-EpisodeName
Mon Nov 26 2018 23:43:45 INFO VideoSort: MatchesDict([('title', 'Tell Me a Story US'), ('country', <Country [US]>), ('season', 1), ('episode', 4), ('format', u'WEBRip'), ('video_codec', u'h264'), ('release_group', u'tbs'), ('container', u'mkv'), ('mimetype', u'video/x-matroska'), ('type', u'episode'), ('vtype', 'series'), ('episode_title', 'Chapter 4: Rage')])
Mon Nov 26 2018 23:43:45 INFO VideoSort: Type: series
Mon Nov 26 2018 23:43:45 INFO VideoSort: MatchesDict([('title', 'Tell Me a Story US'), ('country', <Country [US]>), ('season', 1), ('episode', 4), ('format', u'WEBRip'), ('video_codec', u'h264'), ('release_group', u'tbs'), ('container', u'mkv'), ('mimetype', u'video/x-matroska'), ('type', u'episode'), ('vtype', 'series'), ('episode_title', 'Chapter 4: Rage')])
Mon Nov 26 2018 23:43:45 INFO VideoSort: format: %sn/Season %0s [%qf %qss]/%sn - [S%0sE%0e] - %en.%ext
Mon Nov 26 2018 23:43:45 INFO VideoSort: path after subst: Tell Me a Story Us/Season 01 [WEBRip ]/Tell Me a Story Us - [S01E04] - Chapter 4 Rage..mkv



ALSO as of today I am having an issue where the first letter of a Series name is cut off and the second letter is capitalized and missing title:

VideoSort: filename: \\hidden\Incoming\Mr.Robot.S03E10.BDRip.x264-DEMAND\e7fedc0e34e945f982f2c387f12665db.mkv
Tue Nov 27 2018 09:45:48 INFO VideoSort: stripped filename: r.Robot.S03E10.BDRip.x264-DEMAND\e7fedc0e34e945f982f2c387f12665db.mkv
Tue Nov 27 2018 09:45:48 INFO VideoSort: ['r.Robot.S03E10.BDRip.x264-DEMAND', 'e7fedc0e34e945f982f2c387f12665db.mkv']
Tue Nov 27 2018 09:45:48 INFO VideoSort: Detected obfuscated filename e7fedc0e34e945f982f2c387f12665db.mkv, removing from guess path
Tue Nov 27 2018 09:45:48 INFO VideoSort: Guessing: r.Robot.S03E10.BDRip.x264-DEMAND\-.mkv
Tue Nov 27 2018 09:45:48 INFO VideoSort: MatchesDict([('title', u'r Robot'), ('season', 3), ('episode', 10), ('format', u'BluRay'), ('video_codec', u'h264'), ('release_group', u'DEMAND'), ('container', u'mkv'), ('mimetype', u'video/x-matroska'), ('type', u'episode')])
Tue Nov 27 2018 09:45:48 INFO VideoSort: Type: series
Tue Nov 27 2018 09:45:48 INFO VideoSort: MatchesDict([('title', u'r Robot'), ('season', 3), ('episode', 10), ('format', u'BluRay'), ('video_codec', u'h264'), ('release_group', u'DEMAND'), ('container', u'mkv'), ('mimetype', u'video/x-matroska'), ('type', u'episode'), ('vtype', 'series')])
Tue Nov 27 2018 09:45:48 INFO VideoSort: format: %sn/Season %0s [%qf]/%sn - [S%0sE%0e] - %en.%ext
Tue Nov 27 2018 09:45:48 INFO VideoSort: path after subst: R Robot/Season 03 [BluRay]/R Robot - [S03E10] - ..mkv


I changed line 932 from "new_name = filename[len(start)+1:]" to "new_name = filename[len(start):" for now which appear to have fixed my 1 character missing on rename issue BUT who knows if that will cause me issues with other files.

douche
Posts: 50
Joined: 08 Feb 2014, 23:50

Re: [PP-Script] VideoSort - better video sorting

Post by douche » 11 Dec 2018, 19:54

Per the last post, I'm also having the first letter of a show being dropped.

It's fairly inconsistent, usually seems to happen with shows that start with "The" or another short first word.

Identifier
Posts: 4
Joined: 12 Jan 2019, 16:41

Can we use VideoSort to generate the Dupe Key?

Post by Identifier » Yesterday, 20:54

Thanks for VideoSort - it's great, especially when reading the "My Cart" RSS feed from NZBGeek.info since it doesn't contain metadata like imdbtitle or imdbyear, so there's no better way to get the clean name/year other than using your script. In fact, NZBGeek.info's Cart RSS feed doesn't contain the newznab imdb ID either, so NZBGet's built-in dupe handling isn't able to work since it doesn't know which NZBs are duplicates.

In this case, when NZBGet isn't able to find a dupekey on its own, would it be possible to have VideoSort simply set the dupekey to the eventual file name? That would cover 99% of cases, and let us avoid ending up with Movie (2018).mkv, Movie (2018) (2).mkv, Movie (2018) (3).mkv etc. This would probably require that VideoSort run as a Scan Script though (instead of a PP script) so that it happens before the duplicates are downloaded... is that possible?

hugbug
Developer & Admin
Posts: 7134
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » Yesterday, 21:29

VideoSort uses python library GuessIt to analyze filenames. In a similar approach a scan-script can be written to generate dupe keys from nzb-filenames. There is no reason to make that as part of VideoSort. A separate script would be easier to write and maintain.

If it's supposed to be used for RSS then it's better to write the script as feed-script to avoid fetching of duplicate nzb-files from indexer. That's not important if you need this for cart feed only but good for general feeds.

I'm afraid I won't be able to write such script any soon because there are many other things to do for the project and I have to prioritize. Maybe you could try to write such script yourself. I could help with tips.

However you should first clarify why your feed doesn't include imdbid. Have you tried adding "&extended=1" to RSS feed URL? That parameter usually makes the feed be filled with additional fields. If that doesn't help ask NzbGeek support. Does this site have links to IMDb for nzbs? If that's the case then they should already have necessary information and it's just a matter of extending feed generator with extra fields.

Identifier
Posts: 4
Joined: 12 Jan 2019, 16:41

Re: [PP-Script] VideoSort - better video sorting

Post by Identifier » Yesterday, 23:10

Thanks for the reply hugbug, that's understandable. Yes, I tried adding &extended=1 to the end of the feed URL but it didn't change anything. I know they have the IMDB data because if you get the results for a specific movie then it will include all of the IMDB information. It's just not showing up in the feed returned for the Cart. I've started a thread with them here: https://nzbgeek.info/showthread.php?tid=12454

I'm currently trying to get as close as possible by writing RSS filter scripts that set the dupekey. Here's what I have so far. (By the way, I would have used \d instead of [0-9] everywhere but \d doesn't seem to work. At least \w and \W work though :D) If you can think of a more concise way to strip punctuation in POSIX regex, please let me know. Also this might still not be foolproof if different titles have different lowercased/uppercased words. I don't know how to normalize the case using this script, or if NZBGet even considers case in dupekeys or not.

Code: Select all

# For standard movie and episode titles, grab everything up to the year or season/episode, including any dots, spaces, punctuation, etc.
O(dupekey:${1}): $(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))

# For better duplicate matching, attempt to separate out the words to ignore differences in punctuation (dots vs spaces, parenthesis around years, etc).
O(dupekey:${1} ${2}): $(\w+)\W+(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3}): $(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3} ${4}): $(\w+)\W+(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3} ${4} ${5}): $(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3} ${4} ${5} ${6}): $(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3} ${4} ${5} ${6} ${7}): $(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8}): $(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))
O(dupekey:${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9}): $(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W+(\w+)\W*(.*((19|20)[0-9][0-9]|S[0-9][0-9](E[0-9][0-9])?))

# Adjust the duplicate score based on personal preferences.
O(dupescore+:720): 720 | 720p
O(dupescore+:1080): 1080 | 1080p
O(dupescore+:2160): 2160 | 2160p
O(dupescore+:-1000): size:<5GB
O(dupescore+:-1000): size:>15GB
O(dupescore+:-1000): size:>40GB
O(dupescore+:-1000): category:foreign

# Copy over the category (needed for NZBGeek feeds since NZBGet doesn't get the category from them correctly).
O(category:${1}): category:$(.*)

# Finally, accept all items along with whatever attributes we added above (if any).
A: *

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest