Giter VIP home page Giter VIP logo

torrent-name-parser's People

Stargazers

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

Watchers

 avatar  avatar  avatar

torrent-name-parser's Issues

Warning: Future code incompatibility.

From cargo t

warning: the following packages contain code that will be rejected by a future version of Rust: criterion v0.3.5
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 65`

Looks like the criterion crate needs to be updated.

Episode Regex Matching Multiple Episode / use of full word `episode`

Hi,

Could you provide me with some examples where episode has been used in the naming of torrent files. I don't see any in the test cases. Perhaps reach out to any you know that use this crate?

Also, I doubt it much these days, but there were times that a single file might contain two episodes in a single file. So it would be named something like S01E01E02

I know this might not be an issue. But I will put it here as something to be aware of.

Thoughts of additional functionality for discussion

I have a number of other items that I would like to add. Rather than making individual issues at this time, I would like to list them here and open the discussion.

  • Add is_show() method. Uses the fact that TV Shows have Seasons and movies do not.

  • Add is_special() method. Uses the fact that TV Shows have a Season 00 for specials per TVDB database.

  • Consider adding a trait for something like short_file_name() and or detailed_file_name()

    • The idea here is developers / users could then implement their own functions to create custom file names for renaming files.
    • Of course one could also implement the Display trait

Parse season and episode number when they are separated by `-`.

Some filenames containing season and episode tags separated by - fail to parse correctly.

[SubsPlease] Dr. Stone S2 - 07 (1080p) [33538C7C]
[SubsPlease] Fumetsu no Anata e S2 - 01 (1080p) [1D65E30D]

When these filenames are parsed the season tag gets included in the title.

resolution not detected

Resolution is not detected when located at the end of the string

Black Widow 2021 FRENCH BluRay 1080p
return
None for the resolution
same for Black Widow 2021 FRENCH BluRay 720p

Needs a license file.

This repo needs a license file.
Without a license this repo is technically "all rights reserved" and should not be modified or contributed to.

How to solve title name reconstruction

I know this is not something that the crate itself needs to handle. But I thought I would offer my thoughts here.

In a related project I am working on creating a small crate which offers some extension to this crate. I am using traits to extend this functionality. As part of this. I want to be able to correctly create a directory name for the torrent.

In my own planned usage of this crate I will need to correctly re-constitute the title from the Metadata struct.
There are some cases where this is difficult to do. This is usually due to the use of . periods as delimiters. Though these are also used in the final title. The cases where this happens is rather small.

In a previous module I created using Perl I ended up using a hash to take deconstructed titles and provide the fixed correct title.
Example:

  • s.w.a.t.s01 gets broken down to s w a t but should be rebuilt as S.W.A.T.
    Another that I can already see having trouble is Marvel's Agents of S.H.I.E.l.D.
    Just using the capitalise crate doesn't work as it return S W a T

My current idea and proto type is as follows

use std::collections::HashMap;

#[allow(dead_code)]
pub fn create_demangle_map() -> HashMap<&'static str, &'static str> {
    let title_to_fixed_title: HashMap<_, _> = [
        ("m a s h", "MASH"),
        ("s w a t", "S.W.A.T."),
        (
            "marvel\'s agents of s h i e l d",
            "Marvel\'s Agents of S.H.I.E.L.D.",
        ),
    ]
    .iter()
    .map(|&(k, v)| (k, v))
    .collect();
    title_to_fixed_title
}

#[test]
fn demangle_names() {
    let demangle_map = create_demangle_map();
    assert_eq!(demangle_map.get("test"), None);
    assert_eq!(demangle_map.get("m a s h"), Some(&"MASH"));
    assert_eq!(demangle_map.get("s w a t"), Some(&"S.W.A.T."));
    println!("{}", demangle_map.get("s w a t").unwrap());
}

I am building this title-demangler as a stand alone crate to make it easy to update without affecting TNP
I don't plan to make it available on crates.io But it might be nice to include a reference to my eventual repo so that people might contribute to it, or know how to implement it for themselves in the future.

Shorten some Regex patterns by enabling case-insensitive option (?i)

Some of the regex patterns could be shortened by using the `(?i) option

    pub static ref SEASON: Pattern =
        regex!(r"(?i)s?(?P<short>\d+) ?[ex]|(season)(?:[^\d]|$)(?P<long>\d+)|s(?P<dash>\d+) - \d+");

I can make fork and submit a pull request if you are interested.

Really like your implementation though.

Recognize "WEB" (without "-DL" or "Rip") as a quality

Apparently it's quite common:

$ curl https://torrent-paradise.ml/api/search\?q\=fargo | jq 'map(.text)' | grep WEB
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 20514    0 20514    0     0   333k      0 --:--:-- --:--:-- --:--:--  333k
  "Fargo.S04E03.WEB.x264-PHOENiX[TGx]",
  "Fargo.S04E06.1080p.WEB.H264-CAKES[TGx]",
  "Fargo.S04E03.1080p.WEB.H264-CAKES[TGx]",
  "Fargo.S04E07.PROPER.1080p.WEB.H264-STRONTiUM[TGx]",
  "Fargo.S04E04.The.Pretend.War.1080p.AMZN.WEBRip.DDP5.1.x264-TOMMY",
  "Fargo.S04E01.Welcome.to.the.Alternate.Economy.1080p.AMZN.WEBRip.",
  "Fargo.S04E03.Raddoppiarlo.1080p.AMZN.WEBRip.DDP5.1.x264-TOMMY[TG",
  "Fargo.S04E05.1080p.WEB.H264-CAKES",
  "Fargo.S04E03.720p.WEB.x265-MiNX[TGx]",
  "Fargo.S04E02.The.Land.of.Talking.and.Killing.1080p.HULU.WEBRip.D",
  "Fargo.S04E02.The.Land.of.Talking.and.Killing.1080p.AMZN.WEBRip.D",
  "Fargo.S04E07.Lay.Away.720p.AMZN.WEBRip.DDP5.1.x264-TOMMY[eztv.io].mkv",
  "Fargo.S04E07.WEBRip.x264-ION10[eztv.io].mp4",
  "Fargo.S04E06.1080p.WEB.H264-CAKES[eztv.io].mkv",
  "Fargo.S04E07.Lay.Away.1080p.AMZN.WEBRip.DDP5.1.x264-TOMMY[eztv.io].mkv",
  "Fargo.S04E07.PROPER.1080p.WEB.H264-STRONTiUM[eztv.io].mkv",
  "Fargo.S04E06.720p.WEB.H264-CAKES[TGx]",
  "Fargo.S04E06.1080p.WEB.H264-CAKES",
  "Fargo.S04E01.1080p.WEB.H264-VIDEOHOLE[TGx]",
  "Fargo Season 3 1080p WEBRip 6CH x265 HEVC-PSA",
  "Fargo.S04E01.REPACK.720p.WEBRip.x264-BAE[eztv.io].mkv",
  "Fargo.S04E03.WEB.x264-PHOENiX[eztv.io].mkv",
  "Fargo.S04E04.The.Pretend.War.REPACK.720p.AMZN.WEBRip.DDP5.1.x264-TOMMY[eztv.io].mkv",
  "Fargo S02 Season 2 Complete 1080p WEB-DL [rartv]",
  "Fargo.S03E01.WEBRip.x264-FUM[ettv]",
  "Fargo.S04E07.PROPER.720p.WEB.H264-STRONTiUM[eztv.io].mkv",
  "Fargo.S04E04.The.Pretend.War.REPACK.720p.AMZN.WEBRip.DDP5.1.x264",
  "Fargo.S04E01.Welcome.to.the.Alternate.Economy.1080p.HULU.WEB-DL.AAC2.0.H.264-Cinefeel[eztv.io].mkv",
  "Fargo.SEASON.02.S02.COMPLETE.720p.WEB.2CH.x265.HEVC-PSA",
  "Fargo.S04E03.Raddoppiarlo.720p.AMZN.WEBRip.DDP5.1.x264-TOMMY[TGx",
  "Fargo.S04E01.Welcome.to.the.Alternate.Economy.1080p.HULU.WEBRip.",
  "Fargo.S04E03.WEBRip.x264-BAE[eztv.io].mkv",
  "Fargo.S04E04.720p.WEBRip.x264-BAE[eztv.io].mkv",
  "Fargo.S04E03.720p.WEBRip.x264-BAE[eztv.io].mkv",
  "Fargo.S03E02.WEB-DL.x264-FUM[ettv]",
  "Fargo.S04E03.1080p.WEB.H264-CAKES[eztv.io].mkv",
  "Fargo.S04E02.REPACK.720p.WEBRip.x264-BAE[eztv.io].mkv",
  "Fargo.S04E01.REPACK.WEBRip.x264-BAE[TGx]",
  "Fargo.SEASON.03.S03.COMPLETE.720p.WEB.2CH.x265.HEVC-PSA",
  "Fargo.S04E02.The.Land.of.Talking.and.Killing.1080p.HULU.WEB-DL.DD+5.1.H.264-Cinefeel[eztv.io].mkv",
  "Fargo.S04E02.The.Land.of.Talking.and.Killing.1080p.HULU.WEBRip.DDP5.1.x264-Cinefeel[eztv.io].mkv",
  "Fargo.S04E03.Raddoppiarlo.720p.AMZN.WEBRip.DDP5.1.x264-TOMMY[eztv.io].mkv",
  "Fargo.SEASON.02.S02.COMPLETE.1080p.WEB-DL.6CH.x265.HEVC-PSA",
  "Fargo.S04E04.WEBRip.x264-BAE[eztv.io].mkv",
  "Fargo.S04E04.The.Pretend.War.1080p.AMZN.WEBRip.DDP5.1.x264-TOMMY[eztv.io].mkv",
  "Fargo.S04E03.720p.WEB.x265-MiNX[eztv.io].mkv",
  "Fargo.S04E01.REPACK.720p.WEBRip.x264-BAE[TGx]",
  "Fargo.S04E03.WEBRip.x264-BAE[TGx]",
  "Fargo.S04E02.1080p.WEB.H264-VIDEOHOLE",

Using Enums in place of some String values

Hi,
I was wondering if you have looked at some of the work done by @mcronce in this optimised branch. Specifically the use of enums for the resolution and quality.

These improvements would ensure more consistent data from this crate. Allowing for more ease in generating nice output for crate users.

Thoughts?

Re-implement Metadata::from using trait FromStr which provides the parse() call.

This will allow you to do

let metadata = "The EXPANSE - S03 E01 - Fight or Flight (1080p - AMZN Web-DL)".parse()

You can keep the existing Metadata::from() by call Metadata::from_str() from within I think.

code:

use std::{convert::TryFrom, str::FromStr};

impl FromStr for Metadata {
    type Err = ErrorMatch;
...
}

impl TryFrom<&str> for Metadata {
    type Error = ErrorMatch;

    fn try_from(s: &str) -> Result<Self, Self::Error> {
        Metadata::from_str(s)
    }
}

Season & Episode converted from string to digits

Question as to why season and episodes have been converted to digits?

If in the future someone, myself included, wants to build their own file name from the struct. They would need to reformat season and episode to generate the standard double digit representation.

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.