This repository has been archived by the owner on Nov 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Historical commit version 3.0 (08.09.2013).
- Loading branch information
Showing
4 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
# Author: Andrey Prygunkov ([email protected]). | ||
# Web-site: http://nzbget.sourceforge.net/VideoSort. | ||
# License: GPLv3 (http://www.gnu.org/licenses/gpl.html). | ||
# PP-Script Version: 2.0. | ||
# PP-Script Version: 3.0. | ||
# | ||
# NOTE: This script requires Python 2.x to be installed on your system. | ||
|
||
|
@@ -151,6 +151,14 @@ | |
# resulting filename will be "My Show - S01E02E03.mkv". | ||
#EpisodeSeparator=E | ||
|
||
# Treat year following title as part of title (yes, no). | ||
# | ||
# For seasoned TV shows: if year in the file name goes directly after | ||
# show name, it will be added to show name. This may be necessary for | ||
# media players like XBMC, Boxee or Plex (or anyone using TheTVDB) to | ||
# properly index TV show. | ||
#SeriesYear=yes | ||
|
||
# Formatting rules for dated TV shows. | ||
# | ||
# Specifiers: | ||
|
@@ -277,6 +285,7 @@ | |
satellites=len(satellite_extensions)>0 | ||
lower_words=os.environ['NZBPO_LOWERWORDS'].replace(' ', '').split(',') | ||
upper_words=os.environ['NZBPO_UPPERWORDS'].replace(' ', '').split(',') | ||
series_year=os.environ.get('NZBPO_SERIESYEAR', 'yes') == 'yes' | ||
|
||
tv_categories=os.environ['NZBPO_TVCATEGORIES'].lower().split(',') | ||
category=os.environ.get('NZBPP_CATEGORY', ''); | ||
|
@@ -747,15 +756,31 @@ def add_dated_mapping(guess, mapping): | |
def guess_info(filename): | ||
""" Parses the filename using guessit-library """ | ||
|
||
if force_nzbname: | ||
use_nzbname = force_nzbname | ||
|
||
if not use_nzbname: | ||
fn = os.path.splitext(os.path.basename(filename))[0] | ||
if fn.find('.')==-1 and fn.find('_')==-1 and fn.find(' ')==-1: | ||
print("Detected obfuscated filename %s, using NZB-Name instead" % os.path.basename(filename)) | ||
use_nzbname = True | ||
|
||
if use_nzbname: | ||
guessfilename = os.path.join(os.path.dirname(filename), os.path.basename(download_dir)) + os.path.splitext(filename)[1] | ||
else: | ||
guessfilename = filename | ||
|
||
guess = guessit.guess_file_info(guessfilename, filetype = 'autodetect', info = ['filename']) | ||
|
||
if verbose: | ||
print('Guessing: %s' % guessfilename) | ||
|
||
matcher = guessit.matcher.IterativeMatcher(unicode(guessfilename), filetype='autodetect', opts=['nolanguage', 'nocountry']) | ||
mtree = matcher.match_tree | ||
guess = matcher.matched() | ||
|
||
if verbose: | ||
print(mtree) | ||
for node in mtree.nodes(): | ||
if node.guess: | ||
print(node.guess) | ||
print(guess.nice_string()) | ||
|
||
# fix some strange guessit guessing: | ||
|
@@ -766,8 +791,22 @@ def guess_info(filename): | |
guess['title'] = guess.get('series') | ||
guess['year'] = '1900' | ||
if verbose: | ||
print('episode without episodeNumber is a movie') | ||
print(guess.nice_string()) | ||
|
||
# detect if year is part of series name | ||
if guess['type'] == 'episode' and series_year: | ||
last_node = None | ||
for node in mtree.nodes(): | ||
if node.guess: | ||
if last_node != None and node.guess.get('year') != None and last_node.guess.get('series') != None: | ||
guess['series'] += ' ' + str(guess['year']) | ||
if verbose: | ||
print('year is part of title') | ||
print(guess.nice_string()) | ||
break | ||
last_node = node | ||
|
||
if guess['type'] == 'movie': | ||
date = guess.get('date') | ||
if date: | ||
|
Empty file.
Empty file.