igi-111 / torrent-name-parser Goto Github PK
View Code? Open in Web Editor NEWParse torrent names for metadata
License: MIT License
Parse torrent names for metadata
License: MIT License
Is it possible to deciper the whole paths something like : https://jellyfin.org/docs/general/server/media/subtitles.html
Current SEASON Pattern fails
Returns a value of None
All.Creatures.Great.And.Small.2020.S01.AMZN.WEBRip.x264-ION10[eztv.re]
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.
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.
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()
Display
traitSome 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.
When this title is parsed.
title()
returns "The Last of" and country()
returns "Us"
Expect Title to be "The Last of Us" with country being None
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
This repo needs a license file.
Without a license this repo is technically "all rights reserved" and should not be modified or contributed to.
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.
Marvel's Agents of S.H.I.E.l.D.
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.
Would be possible to capture country? For shows like
Life on Mars (UK)
Life on Mars (US)
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.
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",
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?
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)
}
}
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 that the regex crate be updated to 1.5.5
https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html
I tend to work with files and not directories. So I tend to use the file extension.
Add support to obtain extension.
Doctor.Who.(2003).S01E01.avi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.