Giter Site home page Giter Site logo

parse-torrent-name's People

Contributors

blakev avatar davidvuong avatar divijbindlish avatar roidayan avatar tijptjik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parse-torrent-name's Issues

Test with Hyphen in the name is broken

Came across while adding some tests:

AssertionError: u'Jack And The Cuckoo' != u'Jack And The Cuckoo-Clock Heart'
- Jack And The Cuckoo
+ Jack And The Cuckoo-Clock Heart
?                    ++++++++++++
iMac-27:git ladmin$ git clone https://github.com/divijbindlish/parse-torrent-name.git PTN
Cloning into 'PTN'...
remote: Counting objects: 294, done.
remote: Total 294 (delta 0), reused 0 (delta 0), pack-reused 294
Receiving objects: 100% (294/294), 50.57 KiB | 269.00 KiB/s, done.
Resolving deltas: 100% (149/149), done.
iMac-27:git ladmin$ cd PTN
iMac-27:PTN ladmin$ cd tests/
iMac-27:tests ladmin$ python test_parse.py 
Test: The Walking Dead S05E03 720p HDTV x264-ASAP[ettv]
Test: Hercules (2014) 1080p BrRip H264 - YIFY
Test: Dawn.of.the.Planet.of.the.Apes.2014.HDRip.XViD-EVO
Test: The Big Bang Theory S08E06 HDTV XviD-LOL [eztv]
Test: 22 Jump Street (2014) 720p BrRip x264 - YIFY
Test: Hercules.2014.EXTENDED.1080p.WEB-DL.DD5.1.H264-RARBG
Test: Hercules.2014.Extended.Cut.HDRip.XViD-juggs[ETRG]
Test: Hercules (2014) WEBDL DVDRip XviD-MAX
Test: WWE Hell in a Cell 2014 PPV WEB-DL x264-WD -={SPARROW}=-
Test: UFC.179.PPV.HDTV.x264-Ebi[rartv]
Test: Marvels Agents of S H I E L D S02E05 HDTV x264-KILLERS [eztv]
Test: X-Men.Days.of.Future.Past.2014.1080p.WEB-DL.DD5.1.H264-RARBG
Test: Guardians Of The Galaxy 2014 R6 720p HDCAM x264-JYK
Test: Marvel's.Agents.of.S.H.I.E.L.D.S02E01.Shadows.1080p.WEB-DL.DD5.1
Test: Marvels Agents of S.H.I.E.L.D. S02E06 HDTV x264-KILLERS[ettv]
Test: Guardians of the Galaxy (CamRip / 2014)
Test: The.Walking.Dead.S05E03.1080p.WEB-DL.DD5.1.H.264-Cyphanix[rartv]
Test: Brave.2012.R5.DVDRip.XViD.LiNE-UNiQUE
Test: Lets.Be.Cops.2014.BRRip.XViD-juggs[ETRG]
Test: These.Final.Hours.2013.WBBRip XViD
Test: Downton Abbey 5x06 HDTV x264-FoV [eztv]
Test: Annabelle.2014.HC.HDRip.XViD.AC3-juggs[ETRG]
Test: Lucy.2014.HC.HDRip.XViD-juggs[ETRG]
Test: The Flash 2014 S01E04 HDTV x264-FUM[ettv]
Test: South Park S18E05 HDTV x264-KILLERS [eztv]
Test: The Flash 2014 S01E03 HDTV x264-LOL[ettv]
Test: The Flash 2014 S01E01 HDTV x264-LOL[ettv]
Test: Lucy 2014 Dual-Audio WEBRip 1400Mb
Test: Teenage Mutant Ninja Turtles (HdRip / 2014)
Test: Teenage Mutant Ninja Turtles (unknown_release_type / 2014)
Test: The Simpsons S26E05 HDTV x264 PROPER-LOL [eztv]
Test: 2047 - Sights of Death (2014) 720p BrRip x264 - YIFY
Test: Two and a Half Men S12E01 HDTV x264 REPACK-LOL [eztv]
Test: Dinosaur 13 2014 WEBrip XviD AC3 MiLLENiUM
Test: Teenage.Mutant.Ninja.Turtles.2014.HDRip.XviD.MP3-RARBG
Test: Dawn.Of.The.Planet.of.The.Apes.2014.1080p.WEB-DL.DD51.H264-RARBG
Test: Teenage.Mutant.Ninja.Turtles.2014.720p.HDRip.x264.AC3.5.1-RARBG
Test: Gotham.S01E05.Viper.WEB-DL.x264.AAC
Test: Into.The.Storm.2014.1080p.WEB-DL.AAC2.0.H264-RARBG
Test: Lucy 2014 Dual-Audio 720p WEBRip
Test: Into The Storm 2014 1080p BRRip x264 DTS-JYK
Test: Sin.City.A.Dame.to.Kill.For.2014.1080p.BluRay.x264-SPARKS
Test: WWE Monday Night Raw 3rd Nov 2014 HDTV x264-Sir Paul
Test: Jack.And.The.Cuckoo-Clock.Heart.2013.BRRip XViD
F
======================================================================
FAIL: test_parser (__main__.ParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_parse.py", line 34, in test_parser
    self.assertEqual(result1, expected_result[key])
AssertionError: u'Jack And The Cuckoo' != u'Jack And The Cuckoo-Clock Heart'
- Jack And The Cuckoo
+ Jack And The Cuckoo-Clock Heart
?                    ++++++++++++


----------------------------------------------------------------------
Ran 1 test in 0.019s

FAILED (failures=1)
iMac-27:tests ladmin$ 

Unable to PIP Install.

Hi,
I am currently running Python 3.7.1. When attempting to do "pip install parse-torrent-name", i get the following error:

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Unfortunately, I wasnt sure how to fix this error myself, however one way I got around to be able to use your wonderful script was by doing the following:

  1. Create a new folder locally called PTN.
  2. Inside the folder I created 2 new files called parse.py and patterns.py
  3. Then for each of the new files, I copied the raw code, from this github, for each of the respective files and pasted them to their respective files above.
  4. Finally the last fix I had to apply, was within your local parse.py file, I had to change .patterns to pattern, to make it:from patterns import patterns, types.

Now you can make use of the script as you please, I tested it and it works well.

Parse TV.Show.2017.07.01 episode names

Would it be possible to add support for parsing TV names where episodes are designated by date?

I could see two methods for parsing TV.Show.2017.07.01

  1. Add month and year keys
  2. Recognize 2017.07.01 as the episode

Parsing episode names with year numbers in them results in an incorrect release `year`

Examples:

# ./cli.py  "Attack on Titan - S04E21 - From.You,2000.Years.Ago WEBDL-480p"
{
  "episode": 21,
  "quality": "WEB-DL",
  "title": "Attack on Titan",
  "season": 4,
  "encoder": "Years.Ago",
  "year": 2000,
  "resolution": "480p",
  "episodeName": "From You,"
}

# ./cli.py "Heroes - S03E23 - 1961 Bluray-720p"
{
  "episode": 23,
  "quality": "Blu-ray",
  "title": "Heroes",
  "season": 3,
  "year": 1961,
  "resolution": "720p"
}

# ./cli.py "Stargate SG-1 - S02E21 - 1969 HDTV-720p"
{
  "episode": 21,
  "quality": "HDTV",
  "title": "Stargate SG-1",
  "season": 2,
  "year": 1969,
  "resolution": "720p"
}

This obviously creates some issues when I send release year as 1969 for Stargate SG-1, for example :)

Error when dowloading in python 3.11.5

Error Info:

(base) PS C:\sifat\code\python> pip install parse-torrent-name
Collecting parse-torrent-name
  Using cached parse-torrent-name-1.1.1.tar.gz (9.0 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\sifat\AppData\Local\Temp\pip-install-9g3f47oe\parse-torrent-name_a64ae7154b3549c0a56ea6b23b3427f0\setup.py", line 5, in <module>
          description = f.read()
                        ^^^^^^^^
        File "C:\Users\sifat\miniconda3\Lib\encodings\cp1252.py", line 23, in decode
          return codecs.charmap_decode(input,self.errors,decoding_table)[0]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 292: character maps to <undefined>
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Add support for complete TV show seasons, without episode numbering

The following example does not find the season, for example when a complete season is given without episode numbering in the title:

friends.s02.720p.bluray-sujaidr

In my limited testing, changing the regex in patterns.py in the following way outputs the season only:
from
('season', '(s?([0-9]{1,2}))[ex]')
to
('season', '(s?([0-9]{1,2}))')

But I can clearly see cases where it doesn't work and I have also for my usage added a new keyword, although there are
some redundancy... (Only change is forcing s as a prefix to the season number:
('complete_season', '(s([0-9]{1,2}))')

Thanks for the great tool by the way!

Question about the field `group` and `excess`

Version : 1.1.1

In [6]: PTN.__version__
Out[6]: '1.1.1'

Hey,
Although you mentioned in the documentation that "PTN does not gaurantee the fields group, excess and episodeName as these fields might be interchanged with each other.".But I still feel that some problems exist when I use.

For example,

  • In examples you give in README.md, I think that "[ettv]" should not be included in field group.For "ettv" is just a BT site, and add their tag at the end of torrent's name.
In [2]: PTN.parse('Mr Robot S01E05 HDTV x264-KILLERS[ettv]')
Out[2]:
{'codec': 'x264',
 'episode': 5,
 'group': 'KILLERS[ettv]',
 'quality': 'HDTV',
 'season': 1,
 'title': 'Mr Robot'}
  • Or Another example,Though it Correcttly extract out the container field,but mistake the group field with container again.
In [5]: PTN.parse("Veep.S06E05.720p.HDTV.x264-AVS.mkv")
Out[5]:
{'codec': 'x264',
 'container': 'mkv',
 'episode': 5,
 'group': 'AVS.mkv',
 'quality': 'HDTV',
 'resolution': '720p',
 'season': 6,
 'title': 'Veep'}

  • This torrent's name is a file pack.The season is not matched out, and It seems that season field appears into field excess.For your regex pattern ('season', '(s?([0-9]{1,2}))[ex]') ,it asked a e (or x, as the begining of episode)
In [4]: PTN.parse("The.Flash.2014.S03.720p.HDTV.x264-Scene")
Out[4]:
{'codec': 'x264',
 'excess': 'S03',
 'group': 'Scene',
 'quality': 'HDTV',
 'resolution': '720p',
 'title': 'The Flash',
 'year': 2014}

Also, Some TV episodes (mainly Asian episodes), their episode tag may start as ep,( For example Boku.Unmei.no.Hito.desu.Ep07.Chi_Jap.HDTVrip.1280X720-ZhuixinFan.mp4),I hope it can be support by your package.

Thank you for your time

Uninstall the script

How can i uninstall the script because normal purge command not working.
I try to use it but after installation when i run it, the error "No module named 'PTN'" pup up no mather what i do.
Please help me with a solution for one of this problems.

Question about the regex if you're willing.

Hey!

I realize this repo is pretty old and basically complete at this point. I did have a question about the regex. I'm a student looking through your code pretty much for some regex practice/understanding. I had a question about the episode field in patterns:
('episode', '(ex(?:[^0-9]|$))'),
The first part is very straightforward, but I don't get the purpose of the non-capturing group. It seems to match any non digit character or the end of the line. What purpose does that serve? I've been wracking my brain for it. It seems like it must be there to exclude false positves on episode numbers but I'm failing at coming up with it.

Thank you for your time

Cant parse only season, multiple season and subs excess with only season

Hello,

Is it possible to add season parsing, if episode is not existing?

The.X.Files.S01.DKsubs.1080p.BluRay.HEVC.x265 - Returns:
{'quality': 'BluRay', 'codec': 'x265', 'resolution': '1080p', 'excess': 'HEVC', 'title': 'The X Files S01 DKsubs'}
I'm in the need of this result
{'quality': 'BluRay', 'season': '1', 'codec': 'x265', 'resolution': '1080p', 'excess': ['HEVC', 'DKsubs'], 'title': 'The X Files'}

Is it also possible to add multiple season parsing?
The.X.Files.S01-S03.DKsubs.1080p.BluRay.HEVC.x265 - Returns:
{'quality': 'BluRay', 'codec': 'x265', 'resolution': '1080p', 'excess': 'HEVC', 'title': 'The X Files S01-S03 DKsubs'}
I'm the need of this result
{'quality': 'BluRay', 'season':['1','2','3'] 'codec': 'x265', 'resolution': '1080p', 'excess': ['HEVC', 'DKsubs'], 'title': 'The X Files'}

Also - if episode is not existing "DKsubs" becomas a part of the title and not in excess.

Thanks

Provide it as a command line utility.

Instead of replacement, this can be a simple extension to what PTN is right now. A string or filepath can be a mandatory argument, and the output should be printed directly on terminal. Optional arguments to output it as INI, JSON, text or YAML can be a plus.

equivalent in jav

Hello,

Nice library but do you have an equivalent in java ?
Thanks

How to parse 2012 (2009 movie)?

This is a though one...
Parsing 2012.2009.BluRay.1080p.x264.YIFY.mp4
produce:

{
    "year": 2012,
    "resolution": "1080p",
    "quality": "BluRay",
    "codec": "x264",
    "container": "mp4",
    "title": "2009",
    "excess": "YIFY"
}

Maybe the order in which takes the thinks? maybe first look for the title (which is always first on the string)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.