Giter Club home page Giter Club logo

mnamer's Introduction

PyPI Tests Coverage Licence Style: Black

mnamer

mnamer (media renamer) is an intelligent and highly configurable media organization utility. It parses media filenames for metadata, searches the web to fill in the blanks, and then renames and moves them.

Currently it has integration support with TVDb and TvMaze for television episodes and TMDb and OMDb for movies.

Documentation

Check out the wiki page for more details.

πŸ’Ύ Installation

$ pip3 install --user mnamer

πŸ€– Automation

$ docker pull jkwill87/mnamer

✍️ Formatting

Using the episode-directory, episode-format, movie-directory, or movie-format settings you customize how your files are renamed. Variables wrapped in braces {} get substituted with of parsed values of template field variables.

🌐 Internationalization

Language is supported by the default TMDb and TVDb providers. You can use the --language setting to set the language used for templating.

mnamer also supports subtitle files (.srt, .idx, .sub). It will use the format pattern used for movie or episode media files with its extension prefixed by its 2-letter language code.

🧰 Settings

USAGE: mnamer [preferences] [directives] target [targets ...]

POSITIONAL:
  [TARGET,...]: media file file path(s) to process

PARAMETERS:
  The following flags can be used to customize mnamer's behaviour. Their long
  forms may also be set in a '.mnamer-v2.json' config file, in which case cli
  arguments will take precedence.

  -b, --batch: process automatically without interactive prompts
  -l, --lower: rename files using lowercase characters
  -r, --recurse: search for files within nested directories
  -s, --scene: use dots in place of alphanumeric chars
  -v, --verbose: increase output verbosity
  --hits=<NUMBER>: limit the maximum number of hits for each query
  --ignore=<PATTERN,...>: ignore files matching these regular expressions
  --language=<LANG>: specify the search language
  --mask=<EXTENSION,...>: only process given file types
  --no-guess: disable best guess; e.g. when no matches or network down
  --no-overwrite: prevent relocation if it would overwrite a file
  --no-style: print to stdout without using colour or unicode chars
  --movie-api={*tmdb,omdb}: set movie api provider
  --movie-directory: set movie relocation directory
  --movie-format: set movie renaming format specification
  --episode-api={tvdb,*tvmaze}: set episode api provider
  --episode-directory: set episode relocation directory
  --episode-format: set episode renaming format specification

DIRECTIVES:
  Directives are one-off arguments that are used to perform secondary tasks
  like overriding media detection. They can't be used in '.mnamer-v2.json'.

  -V, --version: display the running mnamer version number
  --clear-cache: clear request cache
  --config-dump: prints current config JSON to stdout then exits
  --config-ignore: skips loading config file for session
  --config-path=<PATH>: specifies configuration path to load
  --id-imdb=<ID>: specify an IMDb movie id override
  --id-tmdb=<ID>: specify a TMDb movie id override
  --id-tvdb=<ID>: specify a TVDb series id override
  --id-tvmaze=<ID>: specify a TvMaze series id override
  --no-cache: disable request cache
  --media={movie,episode}: override media detection
  --test: mocks the renaming and moving of files

Parameters can either by entered as command line arguments or from a config file named .mnamer-v2.json.

Contributions

Community contributions are a welcome addition to the project. In order to be merged upsteam any additions will need to be formatted with black for consistency with the rest of the project and pass the continuous integration tests run against each PR. Before introducing any major features or changes to the configuration api please consider opening an issue to outline your proposal.

Bug reports are also welcome on the issue page. Please include any generated crash reports if applicable. Feature requests are welcome but consider checking out if it is in the works first to avoid duplication.

mnamer's People

Contributors

dependabot[bot] avatar jkwill87 avatar jonas2k avatar unrob avatar waenhill avatar zendamacf 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mnamer's Issues

Little issue with folder and filename

I have this problem with some files, that I can sort out with a little of work but it would be great if manmer could sort it out without my help. Thanks.

`xxx@xxx:~/movies/Quien a hierro mata [MicroHD 1080p][DTS 5.1-Castellano-AC3 5.1-Castellano+Subs][ES-EN] $ mnamer Quien\ a\ hierro\ mata\ M1080.www.pctnew.org.mkv

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

  • date = 2020-01-27
  • platform = Linux-4.19.66-v7+-armv7l-with-glibc2.17
  • arguments = ['Quien a hierro mata M1080.www.pctnew.org.mkv']
  • python version = 3.8.1
  • mnamer version = 2.0.0

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/main.py", line 32, in main
run()
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/main.py", line 48, in run
targets = Target.populate_paths(settings)
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/target.py", line 58, in populate_paths
targets = [cls(file_path, settings) for file_path in file_paths]
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/target.py", line 58, in
targets = [cls(file_path, settings) for file_path in file_paths]
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/target.py", line 42, in init
self.metadata = parse_metadata(
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/metadata.py", line 211, in parse_metadata
metadata = Metadata(file_path=file_path, media=media_hint)
File "", line 8, in init
File "/home/xxx/.pyenv/versions/3.8.1/lib/python3.8/site-packages/mnamer/metadata.py", line 63, in post_init
" ".join(
TypeError: sequence item 1: expected str instance, list found

=============================== CRASH REPORT END ===============================

Dang, it looks like mnamer crashed! Please consider filling an issue at
https://github.com/jkwill87/mnamer/issues along with this report.

xxx@xxx:/movies/Quien a hierro mata [MicroHD 1080p][DTS 5.1-Castellano-AC3 5.1-Castellano+Subs][ES-EN] $ cd ..
xxx@xxx:/movies $ mv Quien\ a\ hierro\ mata\ [MicroHD\ 1080p][DTS\ 5.1-Castellano-AC3\ 5.1-Castellano+Subs][ES-EN]/ Quien\ a\ hierro\ mata
xxx@xxx:/movies $ cd Quien\ a\ hierro\ mata/
xxx@xxx:/movies/Quien a hierro mata $ mnamer --movie-directory=~/share/kodi/movies_es Quien\ a\ hierro\ mata\ M1080.www.pctnew.org.mkv
Starting mnamer

Processing Movie "Quien a hierro mata M1080.www.pctnew.org.mkv"
no matches found
Quien a Hierro Mata M1080 (best guess)
skip
❱ quit
aborting as per user request

0 out of 1 files processed successfully
xxx@xxx:/movies/Quien a hierro mata $ mnamer --id-tmdb=574376 --movie-directory=~/share/kodi/movies_es Quien\ a\ hierro\ mata\ M1080.www.pctnew.org.mkv
Starting mnamer

Processing Movie "Quien a hierro mata M1080.www.pctnew.org.mkv"
results
❱ Eye for an Eye (2019)
skip
quit
moving to /movies/Quien a hierro mata/~/share/kodi/movies_es/Eye for an Eye (2019).mkv
OK!

1 out of 1 files processed successfully
`

Add an 'edit' command in interactive mode

During interactive we sometimes need to need to be able to edit the the filename by ourself.
Is it possible to get new 'edit' option ?
Then a new prompt with the current name as a predefined entry should be displayed.

Unable to force TVDB ID

Running into issues with file names similar to this:

The.Flash.2014.S04E18.1080p.HDTV.x264-PLUTONiUM.mkv

The TVDB ID of this series is 279121

Here is the output of GuessIt:

For: The.Flash.2014.S04E18.1080p.HDTV.x264-PLUTONiUM.mkv
GuessIt found: {
"title": "The Flash",
"year": 2014,
"season": 4,
"episode": 18,
"screen_size": "1080p",
"format": "HDTV",
"video_codec": "h264",
"release_group": "PLUTONiUM",
"container": "mkv",
"mimetype": "video/x-matroska",
"type": "episode"
}

I'm assuming that it searches TVDB and finds the show "The Flash" (ID 78650), but there was only one season so it returns nothing. However, running the command...

mnamer The.Flash.2014.S04E18.1080p.HDTV.x264-PLUTONiUM.mkv --id 279121

... still doesn't find anything.

Allow extension_mask option to be more flexible

Background

Currently the configuration file only allows a list of bare extension_mask entries. To avoid possible confusion and to make mnamer's configuration parsing more robust it should should disregard leading dots; e.g. either "extension_mask": ["avi"] or "extension_mask": [".avi"] being permissible.

Signal handling in batch mode

When you run the script in batch mode (-b) against a big collection there is no way to stop the script with +C.

It would be to handle signals correctly.

Language Support

I think it would be very nice to add support for other laguages other than english (with fallback to english if the language asked for is not in tvdb for the series). I think that at least tvdb api has some language commands that could be used.
Many thanks.

support for folders

movies come wiht multiple auxiliary files like subtitles, artwork, nfo files.

Seeing issues with thetvdb but the TVDB API is up.

Suddenly seeing issues with the TVDB scraping, i wonder if it could be to do with this

From what I can see, the tvdb api has removed all the spaces in its api which is causing the scraper's regexes to fail, since they have a lot of hard-coded spaces.

https://forums.thetvdb.com/viewtopic.php?f=17&t=48331

mnamer --test_run The.Expanse.S03E08.HDTV.x264-SVA[rarbg]/The.Expanse.S03E08.HDTV.x264-SVA.mkv
Starting mnamer

  • success loading config from /home/loz/.mnamer.json

Detected File
The.Expanse.S03E08.HDTV.x264-SVA.mkv

Query Results
Traceback (most recent call last):
File "/usr/local/bin/mnamer", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/mnamer/main.py", line 533, in main
process_files(targets, media, test_run, id_key, **config)
File "/usr/local/lib/python3.6/dist-packages/mnamer/main.py", line 371, in process_files
hit = next(results)
File "/usr/local/lib/python3.6/dist-packages/mnamer/main.py", line 229, in provider_search
api, api_key=keys.get(api)
File "/usr/local/lib/python3.6/dist-packages/mapi/providers.py", line 64, in provider_factory
}provider.lower()
File "/usr/local/lib/python3.6/dist-packages/mapi/providers.py", line 293, in init
self.token = endpoints.tvdb_login(self.api_key)
File "/usr/local/lib/python3.6/dist-packages/mapi/endpoints.py", line 342, in tvdb_login
assert status == 200 and content.get('token') # TVDb down or unavailable?
AssertionError

mnamer crashes on recursive scan

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

  • date = 2020-02-03
  • platform = Linux-5.3.0-7625-generic-x86_64-with-Ubuntu-19.04-disco
  • arguments = ['-r', './']
  • python version = 3.7.3
  • mnamer version = 2.0.0

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/main.py", line 32, in main
run()
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/main.py", line 48, in run
targets = Target.populate_paths(settings)
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/target.py", line 58, in populate_paths
targets = [cls(file_path, settings) for file_path in file_paths]
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/target.py", line 58, in
targets = [cls(file_path, settings) for file_path in file_paths]
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/target.py", line 43, in init
file_path=file_path, media_hint=settings.media
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/metadata.py", line 214, in parse_metadata
**dataclasses.asdict(metadata), file_path=file_path
File "", line 14, in init
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/metadata.py", line 172, in post_init
self.episode = self._path_data.get("episode")
File "/home/karl/.local/lib/python3.7/site-packages/mnamer/metadata.py", line 201, in setattr
value = converter(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

very minor issue with uppercase extensions

I found that mnamer doesn't detect media files with uppercase extensions on linux:
`
$ mnamer --id-tmdb=319 movies/True.Romance.1993.Directors.Cut.Bluray.1080p.TrueHD.x264-Grym@BTNET/True.Romance.1993.Directors.Cut.Bluray.1080p.TrueHD.x264-Grym@BTNET.MKV
Starting mnamer
no media files found

$ mnamer --id-tmdb=319 movies/True.Romance.1993.Directors.Cut.Bluray.1080p.TrueHD.x264-Grym@BTNET/true.romance.1993.directors.cut.bluray.1080p.truehd.x264-grym@btnet.mkv
Starting mnamer

Processing Movie "true.romance.1993.directors.cut.bluray.1080p.truehd.x264-grym@btnet.mkv"
results
❱ True Romance (1993)
skip
quit

`

Add preview to README

Acceptance Criteria

  • Create an asciinema preview of mnamer
  • Demonstrate some of the utility's functionality
  • Embed in readme page

Fails to find episodes.

Configuration
β€’ movie_api: tmdb
β€’ television_api: tvdb
β€’ verbose: True
β€’ television_template: <$series - >< - $season>x<$episode - >< - $title><$extension>
β€’ extension_mask: [u'avi', u'm4v', u'mp4', u'mkv', u'ts', u'wmv']
β€’ scene: False
β€’ blacklist: [u'.sample.', u'^RARBG.*']
β€’ television_destination: None
β€’ movie_destination: None
β€’ max_hits: 15
β€’ movie_template: <$title ><($year)><$extension>
β€’ replacements: {u'@': u'at', u';': u',', u':': u',', u'&': u'and'}
β€’ help: False
β€’ recurse: False
β€’ batch: False
β€’ api_key_tvdb: RV0E698RSRTOA09L
β€’ api_key_tmdb: db972a607f2760bb19ff8bb34074b4c7

Detected File
Gold Rush - 10x10 -
β€’ series: Gold Rush
β€’ media: television
β€’ episode: 10
β€’ extension: .mkv
β€’ season: 10

Query Results
β€’ None found! Skipping.

Detected File
Homestead Rescue - 06x04 - Cobbers Nightmare
β€’ series: Homestead Rescue
β€’ media: television
β€’ episode: 4
β€’ extension: .mkv
β€’ season: 6

Query Results
[1] Homestead Rescue - 06x04 - Cobbers Nightmare
[RETURN] for default, [s]kip, [q]uit

Fix package requirements

Overview

  • Development requirements are unnecessarily being downloaded and installed by default
  • Bugs like #2 seem to be happening because of outdated requirements

Acceptance Criteria

  • Use concrete version numbers (e.g. requests==2.17.3)
  • Add development dependencies to extras_require section
  • Create a requirements.txt and requirements-dev.txt file that use setup-tools' -e flag to redirect to setup.py requirements

See Also

Cannot use metadata in folder path

The folder path is checked for existence on startup, and if the path doesn't exist, mnamer exits before doing anything. This doesn't work with a metadata format string in the folder path (it won't exist until mnamer creates it).

In mnamer/args.py, lines 68-70:

68| if key.endswith("_directory") and not isdir(value):
69| print(f"mnamer: error: {key} '{value}' cannot be found")
70| exit(0)

Delete these lines and it works perfect.

Apostrophes cause unusual filenames

If an episode has an apostrophe in the title the following letter is capitalized in the filename, Queen's from the title turns into QueenS upon renaming.

Add an 'open' command in interactive mode

When you run the program in interactive mode, you sometimes need to visualize your media before choosing the matching title from a provider.

Could we get an open option to visualize the movie with the default reader ?

Handle MapiNotFoundException

mapi raises a MapiNotFoundException when a query yields no results. When this is encountered mnamer should catch this exception, notify the user, and proceed to the next file without crashing.

Can't match show when names are similar

I am trying to rename Deception (2018) S01E12 however no show is detected. I can see it on the tvdb and the name matches. I have tried several variations but none seem to work.

There are several shows with the name Deception, if the file was named just Deception S01E12 shouldn't it give several options to choose from?

Slash aren't handled

When a movie contain a slash (Face/off (1997)) it will be not be correctly handled and a folder will be created.

/path/to/media/Face/off (1997).mkv

[Feature Request] Support for seasons

When importing a season it would be nice to have mnamer recognize it as a whole season without having it recognize every episode one by one.

The solution would be to use the folder name, and the number of video files (so no counting nfo/txt/jpg) in the directory (not the sub-directories).

I personally want to import my content manually (to avoid wrong name) but having to check each episode isn't really convenient.

Fix destination handling

Acceptance Criteria

Functionality involving the following scenarios need to be reviewed and fixed to ensure that file moving works as expected:

  • Relative destination paths
  • As-needed directory creation
  • cwd / parent path resolution (e.g. ., ..)

KeyError: 'release_date' when searching for some titles

When trying to rename a file I am getting the following error:

Detected File
Shrek 2001 BluRay 1080p TrueHD HEVC-d3g

Query Results
[1] Shrek (2001)
[2] Shrek 2 (2004)
[3] Shrek the Third (2007)
[4] Shrek Forever After (2010)
[5] Shrek the Halls (2007)
[6] Shrek the Musical (2013)
[7] Scared Shrekless (2010)
[8] The Ghost of Lord Farquaad (2003)
[9] Shrek's Thrilling Tales (2012)
[10] Shrek in the Swamp Karaoke Dance Party (2001)
[11] Shrek’s Yule Log (2010)
[12] Shrek Stories (2013)
Traceback (most recent call last):
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python36-32\Scripts\mnamer.exe_main
.py", line 9, in
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\site-packages\mnamer_main
.py", line 385, in main
process_files(targets, user_media, test_run, id_key, **config)
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\site-packages\mnamer_main_.py", line 226, in process_files
hit = next(results)
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\site-packages\mnamer\utils.py", line 235, in provider_search
for result in provider_search.providers[media].search(id_key, **metadata):
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\site-packages\mapi\providers.py", line 115, in search
for result in self._search_title(title, year):
File "c:\users\xxxx\appdata\local\programs\python\python36-32\lib\site-packages\mapi\providers.py", line 160, in _search_title
date=entry["release_date"],
KeyError: 'release_date'

Shows not detecting

For some reason, some shows are not getting detected, even though they pop up on TVDB just fine:

Detected File
O.J. - Made in America S01EP03 (2016) (1080p)

Query Results
  β€’ None found! Skipping.

Detected File
Planet Earth II S01E06 - Cities (2016) (2160p)

Query Results
  β€’ None found! Skipping.

ID Field Templating

I was reviewing the options for formatting and wondering if things from themoviedb like "imdb_id" can be added as a option?

example: The Goonies (tt0089218).mp4

Parse Metadata From Directories

Often media that is downloaded will be in a folder but the folders name might be something like Ford.v.Ferrari.2019.720p.SCREENER.900MB.x264-GalaxyRG[TGx] and renaming it to something like Ford v Ferrari (2019) would be imo better.
I think that it won't be too difficult to pull off and if needed I could help write the code for it

Episode padding not working

Simple test case -

from mapi.metadata import MetadataTelevision

meta = MetadataTelevision(
    media='television',
    series='adventure time',
    season=5,
    episode=3,
    title='Five More Short Graybles'
)

print(meta.format('<$series>-<S$season><E$episode>-<$title>'))

Result - Adventure Time-S05E3-Five More Short Graybles

Expected result - Adventure Time-S05E03-Five More Short Graybles

more renaming options, like format and source

Need templates to include the option of <$format> and <$source> to rename files reading from the filename (or even better, reading the file and detecting the format... although this is probably impossible to do with source) so something like:

/Downloads/Rick.and.Morty.S02E01.Bluray.1080p.x264-RARBG.mp4

is turned into
/Downloads/Rick and Morty - S02E01 (1080p) (Blu-ray).mp4

Add version flag

Acceptance Criteria

  • Add a -v / --version directive flag to the argument parser
  • Display the current mnamer and mapi version when invoked
  • When run simply exit without any other output (e.g. no files found, etc.)

[Feature Request] Display the file size

When using mnamer there is no way to know what is the file size of the file that is being processed, it's a problem especially when the same movie has already been processed before since there is no way to know which one is bigger/better.

Add deployment script

Acceptance Criteria

  • Prompts for update level (e.g. major, minor, hotfix)
  • Updates VERSION in __init__.py
  • Creates version bump commit
  • Creates tag
  • Creates distributable
  • Uploads package to pypi

TypeError: must be str, not list on v2

I'm having problems with some of my videos when trying to rename them. It seems that mnamer doesn't like at all the name of the folder. One example:
mnamer -V --movie_directory '/home/fajumon/share/kodi/movies_vos/' 'Toy Story 4 [MicroHD 1080p][AC3 5.1-DTS 5.1-Castellano-AC3 5.1 Ingles+Subs][ES-EN]/Toy Story IV.mkv' Traceback (most recent call last): File "/home/fajumon/.pyenv/versions/mnamerdev/bin/mnamer", line 11, in <module> load_entry_point('mnamer==2.0.0', 'console_scripts', 'mnamer')() File "/home/fajumon/.pyenv/versions/3.6.9/envs/mnamerdev/lib/python3.6/site-packages/mnamer/__main__.py", line 25, in main targets = Target.populate_paths(args.targets, **config) File "/home/fajumon/.pyenv/versions/3.6.9/envs/mnamerdev/lib/python3.6/site-packages/mnamer/target.py", line 98, in populate_paths targets = {cls(path, **config) for path in paths} File "/home/fajumon/.pyenv/versions/3.6.9/envs/mnamerdev/lib/python3.6/site-packages/mnamer/target.py", line 98, in <setcomp> targets = {cls(path, **config) for path in paths} File "/home/fajumon/.pyenv/versions/3.6.9/envs/mnamerdev/lib/python3.6/site-packages/mnamer/target.py", line 35, in __init__ self.metadata: Metadata = self.parse(path, config.get("media")) File "/home/fajumon/.pyenv/versions/3.6.9/envs/mnamerdev/lib/python3.6/site-packages/mnamer/target.py", line 166, in parse meta["quality"] += " " + data[field] TypeError: must be str, not list
Maybe I need to change the name of the folder before using mnamer but ideally I'd hope the script would take care of it as is...
Any help would be appreciate. Thanks.

Connot found directory

branch is v2
installed from git to a virtualenv.

(mnamer)  ~/mnamer-test-directory $ ls
downloaded-files  moved-files
(mnamer)  ~/mnamer-test-directory $ mnamer --verbose --television-directory="/home/test/mnamer-test-directory/moved-files/{series}" --television-format="{original}" --movie-directory="/home/test/mnamer-test-directory/moved-files/{title:01}" --movie-format="{original}" --config-dump
mnamer: error: television_directory '/home/test/mnamer-test-directory/moved-files/{series}' cannot be found
(mnamer)  ~/mnamer-test-directory $

Letters before dot are capitalized

When a letter is before a dot, it will become capitalized.

Example:
Kill Bill: VoL. 1 (2003)
Kill Bill: VoL. 2 (2004)

Something that might be related:

LA LA Land (2016)

mnamer doesn't recognize .mnamer.json in the user's home directory

Hi,
I created a .mnamer.json by running the following command in my home directory:
mnamer --config_dump >.mnamer.json
I then edited the .mnamer.json file using vi to change the TV directory line to:

"television_directory"/Volumes/Plex/TVShows/{series}/Season {season:02} "",
"television_format": "{series}.S{season:02}E{episode:02}.{title}{extension}",

Then I then run:
mnamer --config_dump, it gives me the default config. Running
"mnamer -b /temp/TVUploads/." doesn't use the new config file but uses the default config instead. Note: It claims to use the .mnamer.json file but it actually doesn't
Is there a command line switch to specify the config location? Maybe you should put one in.
I'm running MacOS 10.13.6 (High Sierra).
Output of mnamer -bv below (note the TV directory line and the TV format line aren't changed despite claiming to have loaded my custom config.

➜ ~ mnamer -bv /Volumes/MacHD/Users/user/Temp/TVUploads/.
loaded config from /Volumes/MacHD/Users/user/.mnamer.json

CLI Arguments

  • batch: True
  • verbose: True

Preferences

  • batch: True
  • lowercase: False
  • recurse: False
  • scene: False
  • verbose: True
  • nocache: False
  • noguess: False
  • nostyle: False
  • blacklist: ['.sample.', '^RARBG.*']
  • extension_mask: ['avi', 'm4v', 'mp4', 'mkv', 'ts', 'wmv']
  • hits: 5
  • movie_api: tmdb
  • movie_directory:
  • movie_format: {title} ({year}){extension}
  • television_api: tvdb
    - television_directory:
    - television_format: {series} - S{season:02}E{episode:02} - {title}{extension}
  • api_key_tmdb: db972a607f2760bb19ff8bb34074b4c7
  • api_key_tvdb: E69C7A2CEF2F3152
  • api_key_omdb: 61652c15
  • replacements: {'&': 'and', '@': 'at', ':': ',', ';': ','}

Directives

  • help: False
  • media_override: False
  • test: False
  • id: False
  • config_dump: False
  • config_ignore: False
  • media_mask: False
  • version: False

Targets

  • /Volumes/MacHD/Users/user/Temp/TVUploads/Fear the Walking Dead - S05E15 - Channel 5.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/Black Jesus - S03E01 - The Compton Carter.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/Pennyworth - S01E09 - Alma Cogan.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/The 100 - S06E08 - The Old Man and The Anomaly.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/The Terror - S02E07 - Infamy My Perfect World.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/The Terror - S02E06 - Infamy Taizo.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/The Terror - S02E05 - Infamy Shatter Like A Pearl.mkv
  • /Volumes/MacHD/Users/user/Temp/TVUploads/The Circus - S04E09 - The People on That Stage.mkv

Starting mnamer

Processing Television "Fear the Walking Dead - S05E15 - Channel 5"

  • media: television
  • series: Fear the Walking Dead
  • season: 5
  • episode: 15
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/Fear the Walking Dead - S05E15 - Channel 5.mkv
    OK!

Processing Television "Black Jesus - S03E01 - The Compton Carter"

  • media: television
  • series: Black Jesus
  • season: 3
  • episode: 1
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/Black Jesus - S03E01 - The Compton Carter.mkv
    OK!

Processing Television "Pennyworth - S01E09 - Alma Cogan"

  • media: television
  • series: Pennyworth
  • season: 1
  • episode: 9
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/Pennyworth - S01E09 - Alma Cogan.mkv
    OK!

Processing Television "The 100 - S06E08 - The Old Man and The Anomaly"

  • media: television
  • series: The 100
  • season: 6
  • episode: 8
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/The 100 - S06E08 - The Old Man and The Anomaly.mkv
    OK!

Processing Television "The Terror - S02E07 - Infamy My Perfect World"

  • media: television
  • series: The Terror
  • season: 2
  • episode: 7
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/The Terror - S02E07 - Infamy My Perfect World.mkv
    OK!

Processing Television "The Terror - S02E06 - Infamy Taizo"

  • media: television
  • series: The Terror
  • season: 2
  • episode: 6
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/The Terror - S02E06 - Infamy Taizo.mkv
    OK!

Processing Television "The Terror - S02E05 - Infamy Shatter Like A Pearl"

  • media: television
  • series: The Terror
  • season: 2
  • episode: 5
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/The Terror - S02E05 - Infamy Shatter Like A Pearl.mkv
    OK!

Processing Television "The Circus - S04E09 - The People on That Stage"

  • media: television
  • series: The Circus
  • season: 4
  • episode: 9
  • extension: .mkv
    moving to /Volumes/MacHD/Users/user/Temp/TVUploads/The Circus - S04E09 - The People on That Stage.mkv
    OK!

8 out of 8 files processed successfully

Config file not loaded

Right, installed mnamer on my NAS running Archlinux ARM using pip3 command.

Dump the config file and made the necessary changes and saved it as ~/.mnamer-V2.json (see config file below)

When I run the command line, all show are detected, renamed (not as setup on the config file) and also not moved as the config file.

python -m mnamer -bv /mnt/hd/Download/

p.s. I had to install it using sudo pip3 install mnamer as it was complaining of some right issue.

{ "api_key_omdb": null, "api_key_tmdb": null, "api_key_tvdb": null, "api_key_tvmaze": null, "batch": false, "episode_api": "tvmaze", "episode_directory": "/mnt/hd/Show/{series}", "episode_format": "{series} - {season:02}x{episode:02} - {title}{extension}", "hits": 5, "ignore": [ ".*sample.*", "^RARBG.*" ], "lower": false, "mask": [ ".avi", ".m4v", ".mp4", ".mkv", ".ts", ".wmv" ], "movie_api": "tmdb", "movie_directory": "/mnt/hd/Movie/{name} ({year})", "movie_format": "{name} ({year}){extension}", "no_cache": false, "no_guess": false, "no_replace": false, "no_style": false, "recurse": false, "replacements": { "&": "and", ":": "", ";": ",", "@": "at" }, "scene": false, "verbose": false }

Crash report

============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

  • date = 2020-02-12
  • platform = Darwin-19.3.0-x86_64-i386-64bit
  • arguments = ['Filme']
  • python version = 3.7.3
  • mnamer version = 2.1.0

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
File "/Library/Python/3.7/site-packages/mnamer/main.py", line 31, in main
run()
File "/Library/Python/3.7/site-packages/mnamer/main.py", line 109, in run
matches = target.query()
File "/Library/Python/3.7/site-packages/mnamer/target.py", line 147, in query
for idx, result in enumerate(results, start=1):
File "/Library/Python/3.7/site-packages/mnamer/providers.py", line 155, in search
yield from results
File "/Library/Python/3.7/site-packages/mnamer/providers.py", line 182, in _search_name
year=entry["release_date"],
KeyError: 'release_date'

--television_destination does not work as expected

Here's an example how to reproduce:

touch /tmp/the.daily.show.2018.03.12.junot.diaz.1080p.web.x264-tbs.mkv

mnamer /tmp/the.daily.show.2018.03.12.junot.diaz.1080p.web.x264-tbs.mkv --batch --television_destination /tmp

Starting mnamer

Detected File
the.daily.show.2018.03.12.junot.diaz.1080p.web.x264-tbs.mkv

Query Results
[1] The Daily Show - 23x71 - March 12, 2018

Processing File

  • moving to '/tmp/The Daily Show - S23E71 - March 12, 2018.mkv'
  • Success!

Successfully processed 1 out of 1 files

ls "/tmp/The Daily Show - S23E71 - March 12, 2018.mkv"
ls: cannot access '/tmp/The Daily Show - S23E71 - March 12, 2018.mkv': No such file or directory

ls /tmp/the*
/tmp/the.daily.show.2018.03.12.junot.diaz.1080p.web.x264-tbs.mkv

TypeError: cannot concatenate 'str' and 'list' objects

Filename: "Il.Discorso.Del.Re.2010.BDrip.1080p.x264.ITA.ENG.DTS.AC3_Carnil91[TNTvillage]"

When it try to match it, it just crash.

Complete output

Detected File
Il.Discorso.Del.Re.2010.BDrip.1080p.x264.ITA.ENG.DTS.AC3_Carnil91[TNTvillage]
Traceback (most recent call last):
File "/usr/local/bin/mnamer", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/mnamer/main.py", line 385, in main
process_files(targets, user_media, test_run, id_key, **config)
File "/usr/local/lib/python2.7/dist-packages/mnamer/main.py", line 213, in process_files
meta = meta_parse(file_path, user_media)
File "/usr/local/lib/python2.7/dist-packages/mnamer/utils.py", line 200, in meta_parse
meta["quality"] += " " + data[field]
TypeError: cannot concatenate 'str' and 'list' objects

Moving movie to movie name's first letter directory

I was categorizing my movies with title's first letter on the directory.
ex: /movies/B/B.Movies.1.mkv
I was doing that with {title:01} on the old version. When I try to do that with {name:01} on the new version I am getting error:

(mnamer)  ~ $ mnamer -b -v tmp/mnamer-downloads-test/
Starting mnamer
loaded config from '/home/user/.mnamer-v2.json'

system
 - date = 2020-02-01
 - platform = Linux-4.15.0-74-generic-x86_64-with-elementary-5.1-hera
 - arguments = ['-b', '-v', 'tmp/mnamer-downloads-test/']
 - python version = 3.6.9
 - mnamer version = 2.0.0

settings
 - targets = [PosixPath('tmp/mnamer-downloads-test')]
 - batch = True
 - lower = False
 - recurse = False
 - scene = False
 - verbose = True
 - hits = False
 - ignore = ['.*sample.*']
 - mask = ['.avi', '.mp4', '.mkv']
 - no_cache = False
 - no_guess = False
 - no_style = False
 - movie_api = tmdb
 - movie_directory = /home/user/mnamer-test-directory/moved-files/{name:01}
 - movie_format = {original}
 - episode_api = tvdb
 - episode_directory = /home/user/mnamer-test-directory/moved-files/{series}
 - episode_format = {original}
 - version = False
 - config_dump = False
 - config_ignore = False
 - id_imdb = None
 - id_tmdb = None
 - id_tvdb = None
 - id_tvmaze = None
 - media = None
 - test = False
 - api_key_omdb = 477a7ebc
 - api_key_tmdb = db972a607f2760bb19ff8bb34074b4c7
 - api_key_tvdb = E69C7A2CEF2F3152
 - api_key_tvmaze = None
 - replacements = {'&': 'and', ':': '', ';': ',', '@': 'at'}

targets
 - /home/user/tmp/mnamer-downloads-test/Back.To.The.Future.1985.1080p.mp4

Processing Movie "Back.To.The.Future.1985.1080p.mp4"
/home/user/tmp/mnamer-downloads-test/Back.To.The.Future.1985.1080p.mp4
using tmdb

search parameters
 - extension = .mp4
 - group = None
 - quality = 1080p blu-ray h.264 aac
 - synopsis = None
 - media = movie
 - name = Back to the Future
 - year = 1985
 - id_imdb = None
 - id_tmdb = None


============================== CRASH REPORT BEGIN ==============================

--------------------------------- environment ----------------------------------

 - date = 2020-02-01
 - platform = Linux-4.15.0-74-generic-x86_64-with-elementary-5.1-hera
 - arguments = ['-b', '-v', 'tmp/mnamer-downloads-test/']
 - python version = 3.6.9
 - mnamer version = 2.0.0

--------------------------------- stack trace ----------------------------------

Traceback (most recent call last):
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/site-packages/mnamer/__main__.py", line 32, in main
    run()
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/site-packages/mnamer/__main__.py", line 136, in run
    if target.destination == target.source:
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/site-packages/mnamer/target.py", line 101, in destination
    dir_head = format(self.metadata, str(self.directory))
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/site-packages/mnamer/metadata.py", line 147, in __format__
    re_pattern, self._format_repl, format_spec or "{name} ({year})"
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/re.py", line 191, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/site-packages/mnamer/metadata.py", line 110, in _format_repl
    value = _MetaFormatter().vformat(format_string, None, self.as_dict)
  File "/usr/lib/python3.6/string.py", line 194, in vformat
    result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
  File "/usr/lib/python3.6/string.py", line 247, in _vformat
    result.append(self.format_field(obj, format_spec))
  File "/home/user/.virtualenvs/mnamer/lib/python3.6/site-packages/mnamer/metadata.py", line 24, in format_field
    return format(v, f) if v else ""
ValueError: '=' alignment not allowed in string format specifier

=============================== CRASH REPORT END ===============================

Dang, it looks like mnamer crashed! Please consider filling an issue at
https://github.com/jkwill87/mnamer/issues along with this report.

(mnamer)  ~ $ 

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.