improved menu setup and updated documentation

This commit is contained in:
simon 2021-05-30 12:17:16 +07:00
parent cbe6a4d77f
commit 90bfbc57bb
2 changed files with 28 additions and 17 deletions

View File

@ -4,9 +4,11 @@
This project is used and tested under Linux and is ideal to be used from something like a Raspberry Pi or a Linux based NAS. If you want to help me to get it to work under Windows, please contribute.
## Run
Clone the repo, setup config file (see below) and run `interface.py`.
Clone the repo, setup config file (see below) and run `interface.py`. Use your arrowkeys no navigate up and down the menu.
* **q** quit the interface
* **r** refresh the pending items by rescanning the filesystem.
## moviesort
## Movies
Detect movie names by querying [themoviedb.org](https://www.themoviedb.org/) API and renaming the file based on a selection of possible matches. Follow the config file instructions bellow to get your API key.
All data is courtesy of [The Movie Database](https://www.themoviedb.org), please contribute to this excellent database.
@ -14,23 +16,23 @@ All data is courtesy of [The Movie Database](https://www.themoviedb.org), please
Movies will get renamed to this nameing style, a more flexible solution is in pending:
**{movie-name} {Year}/{movie-name} {Year}.{ext}**
## tvsort
## TV shows
Detect tv show filenames by querying the publicly available [tvmaze.com](https://www.tvmaze.com/) API to identify the show name and the episode name based on a selection of possible matches.
Episodes are named in this style, a more flexible solution is in pending:
**{show-name}/Season {nr}/show-name - S{nr}E{nr} - {episode-name}.{ext}**
## db_export
Export the library to csv files. Calles the Emby API to get a list of movies and episodes and exports this to a convenient set ov CSV files.
## trailers
## Trailer download
Downloading trailers from links provided from emby and move them into the movie folder.
Trailers are named in this style, a more flexible solution is in pending:
**{movie-name} {Year}_{youtube-id}_trailer.mkv**
## bad_id
## Fix Movie Names
Sometimes Emby get's it wrong. Sometimes this script can get it wrong too. The *Fix Movie Names* function goes through the movie library looking for filenames that don't match with the movie name as identified in emby.
## DB export
Export the library to csv files. Calles the Emby API to get a list of movies and episodes and exports this to a convenient set ov CSV files.
## setup
### install
These are the none standard Python libraries in use in this project:
@ -61,9 +63,14 @@ Duplicate the config.sample.json file to a file named *config.json* and set the
* `min_file_size`: Minimal filesize to be considered a relevant media file in bytes.
#### Emby integration
*optional:* remove the 'emby' key from config.json to disable the emby integration.
* `emby_url`: url where your emby instance is reachable
* `emby_user_id`: user id of your emby user
* `emby_api_key`: api key for your user on emby
#### ydl_opts *Trailer download:*
Arguments under the [ydl_opts] section will get passed in to youtube-dl for *trailers*. Check out the documentation for details.
*optional:* remove the 'ydl_opts' key from config.json to disable the trailer download functionality.
Arguments under the [ydl_opts] section will get passed in to youtube-dl for *trailers*. Check out the documentation for details.
## Known limitations:
Most likely *media_organizer* will fail if there are any files like Outtakes, Extras, Feauturettes, etc in the folder. Should there be any files like that in the folder, moove/delete them first before opening *media_organizer*.

View File

@ -138,15 +138,19 @@ class Interface():
def print_menu(self, current_row_idx):
""" print menu with populated pending count """
# build stdscr
menu = self.menu
h, w = self.stdscr.getmaxyx()
longest = len(max(menu))
x = w // 2 - longest
max_h, max_w = self.stdscr.getmaxyx()
longest = len(max(self.menu))
x = max_w // 2 - longest // 2 - 2
first_menu = max_h // 2 - len(self.menu) // 2
self.stdscr.clear()
# help
self.stdscr.addstr(h - 1, x, 'q: quit, r: refresh')
# menu strings
url = 'github.com/bbilly1/media_organizer'
help_str = 'q: quit, r: refresh'
self.stdscr.addstr(max_h - 2, max_w // 2 - len(help_str) // 2, help_str)
self.stdscr.addstr(max_h - 1, max_w // 2 - len(url) // 2, url)
self.stdscr.addstr(first_menu - 2, x, 'Media Organizer')
# loop through menu items
for idx, row in enumerate(menu):
for idx, row in enumerate(self.menu):
# menu items count
if row == 'All':
pending_count = self.pending['total']
@ -161,7 +165,7 @@ class Interface():
else:
pending_count = ' '
# center whole
y = h // 2 - len(menu) + idx
y = first_menu + idx
# print string to menu
text = f'[{pending_count}] {row}'
if idx == current_row_idx: