[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: 53
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 » 18 Jan 2019, 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: 7260
Joined: 09 Sep 2008, 11:58
Location: Germany

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

Post by hugbug » 18 Jan 2019, 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 » 18 Jan 2019, 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. [Edit: I just tested NZBs with different casing, and looks like uppercase/lowercase is ignored when comparing the dupekeys - so this works great!)

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: *

Rrrr
Posts: 6
Joined: 02 Feb 2019, 18:41

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

Post by Rrrr » 11 Feb 2019, 08:26

douche wrote:
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.
Same here. I do not understand if hugbug's comments are related to this issue. They seem more related to the other issue in the OP.

Any tips?

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

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

Post by hugbug » 11 Feb 2019, 09:02

Rrrr wrote:
11 Feb 2019, 08:26
I'm also having the first letter of a show being dropped.
Can someone provide a sample filename (nzb-name and video file name) with VideoSort settings?

Rrrr
Posts: 6
Joined: 02 Feb 2019, 18:41

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

Post by Rrrr » 11 Feb 2019, 09:48

Code: Select all

The.Big.Bang.Theory.S10E06.The.Fetal.Kick.Catalyst.1080p.WEB-DL.DD5.1.H264-BTN
VideoSort:

Code: Select all

PP-Script Version: 8.0.
SeriesDir: /video/2 - TV Shows
SeriesFormat: %sn/Season %s/%sn - S%0sE%0e - %en
MultipleEpisodes: Range
EpisodeSeparator: E
SeriesYear: Yes
DatedFormat: %sn/%sn - %y-%0m-%0d
OtherTvFormat: %t
LowerWords: the,of,and,at,vs,a,an,but,nor,for,on,so,yet
UpperWords: III,II,IV
DNZBHeaders: Yes
PreferNZBName: No
Overwrite: No
CleanUp: Yes
Preview: No
Verbose: No


Result:

Code: Select all

2 - TV Shows\He Big Bang Theory\Season 10\He Big Bang Theory - S10E06 - The Fetal Kick Catalyst

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

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

Post by hugbug » 11 Feb 2019, 11:15

Rrrr, Thanks.

Weird indeed. I'll look into it.

Rrrr
Posts: 6
Joined: 02 Feb 2019, 18:41

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

Post by Rrrr » 11 Feb 2019, 11:30

Just to note that the behaviour is not consistent:
1) All with BTN in the name go wrong;
2) Some others go wrong as well.

Wrongly named and placed:
S10E02: The Big Bang Theory S10E02 The Military Miniaturization 1080p WEB-DL DD5 1 H 264-BTN
S10E06: The Big Bang Theory S10E06 The Fetal Kick Catalyst 1080p WEB-DL DD5 1 H264-BTN
S10E09: The Big Bang Theory S10E09 The Geology Elevation 1080p WEB-DL DD5 1 H264-R2D2
s10E20: The Big Bang Theory S10E20 1080p WEB-DL DD5 1 H264-RARBG

Correctly named and placed:
S10E08: The Big Bang Theory S10E08 The Brain Bowl Incubation 1080p WEB-DL DD5 1 H264-R2D2
S10E15: The Big Bang Theory S10E15 1080p WEB-DL
s10E16: The Big Bang Theory S10E16 1080p WEB-DL DD5 1 H264-RARBG

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests