mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.51k stars 201 forks source link

Multiple AutoProcess.ini #1363

Closed dramirvf closed 3 years ago

dramirvf commented 3 years ago

I am using Radarr and I am downloading movies in different languages. I want to use SMA to handle different languages separately. I give the example for English Movies and French Movies as follows:

I have two autoProcess.ini files

For English Movies --> autoProcess.ini
For French Movies --> autoProcess-French.ini

For English Movies I have created postRadarr-English.sh which applies to the movies with english tag within Radarr and has the the following content:

#!/usr/bin/env bash
/usr/bin/python3 $SMA_PATH/postRadarr.py

For French Movies I have created postRadarr-French.sh which applies to the movies with french tag within Radarr and has the the following content:

#!/usr/bin/env bash
$SMA_CONFIG = "/$SMA_PATH/config/autoProcess-French.ini";
/usr/bin/python3 $SMA_PATH/postRadarr.py

The script for English Movies runs without any issues, but the script for French Movies returns the following error within Radarr:

11/19/2020 12:41:27 AM - Error - /usr/local/sma/postRadarr-French.sh: line 2: unexpected EOF while looking for matching `"'
11/19/2020 12:41:27 AM - Error - /usr/local/sma/postRadarr-French.sh: line 4: syntax error: unexpected end of file
2020-11-19 04:11:27.8|Warn|RadarrErrorPipeline|Invalid request Validation failed: 
 -- : Script exited with code: 2

How should I resolve the issue?

dramirvf commented 3 years ago

Update: I had two instances of "postRadarr-French.sh" open in the Notepad++ and my final edits did not save properly. After closing the extra instances and resaving the file, it retuned no errors. I need to check whether the script will really do the job I want or not.

One more thing: Is the method I am using the best method to achieve this goal or you have a better recommendation?

mdhiggins commented 3 years ago

You should fix your syntax

You started a quote and didn't close it

EDIT: You fixed this in your revision which is confusing for anyone that finds this later

Original script was

#!/usr/bin/env bash
$SMA_CONFIG = "/$SMA_PATH/config/autoProcessFrench.ini
/usr/bin/python3 $SMA_PATH/postRadarr.py

And I would say it looks correct and you're doing everything appropriately, though you don't need the initial / on line 2 as that's included in the $SMA_PATH variable, you're putting a double slash essentially

dramirvf commented 3 years ago

You should fix your syntax

You started a quote and didn't close it

EDIT: You fixed this in your revision which is confusing for anyone that finds this later

Original script was

#!/usr/bin/env bash
$SMA_CONFIG = "/$SMA_PATH/config/autoProcessFrench.ini
/usr/bin/python3 $SMA_PATH/postRadarr.py

And I would say it looks correct and you're doing everything appropriately, though you don't need the initial / on line 2 as that's included in the $SMA_PATH variable, you're putting a double slash essentially

Thanks. I'll remove it.

dramirvf commented 3 years ago

You should fix your syntax

You started a quote and didn't close it

EDIT: You fixed this in your revision which is confusing for anyone that finds this later

Original script was

#!/usr/bin/env bash
$SMA_CONFIG = "/$SMA_PATH/config/autoProcessFrench.ini
/usr/bin/python3 $SMA_PATH/postRadarr.py

And I would say it looks correct and you're doing everything appropriately, though you don't need the initial / on line 2 as that's included in the $SMA_PATH variable, you're putting a double slash essentially

I have done exactly as we have already discussed, but still the wrong AutoProcess.ini is being loaded.

This post-process custom script is being loaded from Radarr: /usr/local/sma/postRadarr-French.sh

Content of the script:

#!/usr/bin/env bash
$SMA_CONFIG = "$SMA_PATH/config/autoProcess-French.ini";
/usr/bin/python3 $SMA_PATH/postRadarr.py

Radarr log:

2020-11-25 06:10:53.5|Debug|CustomScript|Executing external script: /usr/local/sma/postRadarr-French.sh
2020-11-25 06:10:53.5|Debug|postRadarr-French.sh|Starting /usr/local/sma/postRadarr-French.sh 
2020-11-25 06:10:53.5|Debug|Api|[GET] /api/v3/health: 200.OK (1 ms)
2020-11-25 06:10:53.6|Error|postRadarr-French.sh|/usr/local/sma/postRadarr-French.sh: line 2: =: command not found

SMA log:

2020-11-25 06:10:57 - RadarrPostProcess - INFO - Radarr extra script post processing started.
2020-11-25 06:10:57 - resources.readsettings - INFO - /usr/bin/python3
2020-11-25 06:10:57 - resources.readsettings - INFO - Loading config file /usr/local/sma/config/autoProcess.ini.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Processing /movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Input Data
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - {
    "format": "mov,mp4,m4a,3gp,3g2,mj2",
    "format-fullname": "QuickTime / MOV",
    "video": {
        "index": 0,
        "codec": "h264",
        "bitrate": 2249959,
        "pix_fmt": "yuv420p",
        "profile": "high",
        "fps": 24.0,
        "dimensions": "1904x816",
        "level": 4.1,
        "field_order": "unknown"
    },
    "audio": [
        {
            "index": 1,
            "codec": "aac",
            "bitrate": 127694,
            "channels": 2,
            "samplerate": 48000,
            "language": "eng",
            "disposition": "-default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired"
        }
    ],
    "subtitle": [],
    "attachment": []
}
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Reading video stream.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Video codec detected: h264.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Pix Fmt: yuv420p.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Profile: high.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Video codec parameters None.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Creating copy video stream from source stream 0.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Reading audio streams.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Audio detected for stream 1 - aac eng 2 channel.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Creating ac3 audio stream from source stream 1.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Default audio stream set to eng ac3 2 channel stream [default-more-channels: True].
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Reading subtitle streams.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Scanned for external subtitles and found 1 results in your approved languages.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Skipping external subtitle file Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].srt, no appropriate codecs found or embed disabled.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Output Data
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - {
    "source": [
        "/movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4"
    ],
    "format": "mp4",
    "video": {
        "codec": "copy",
        "map": 0,
        "bitrate": 2129.4725,
        "crf": -1,
        "maxrate": null,
        "bufsize": null,
        "level": 0.0,
        "profile": null,
        "preset": null,
        "pix_fmt": null,
        "field_order": "unknown",
        "width": null,
        "filter": null,
        "params": null,
        "title": "FHD",
        "debug": "video"
    },
    "audio": [
        {
            "map": 1,
            "codec": "ac3",
            "channels": 2,
            "bitrate": 256,
            "filter": null,
            "samplerate": null,
            "language": "eng",
            "disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired",
            "bsf": null,
            "title": "Stereo",
            "debug": "universal-audio"
        }
    ],
    "subtitle": [],
    "attachment": []
}
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Preopts
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - []
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Postopts
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - [
    "-threads",
    "0",
    "-metadata:g",
    "encoding_tool=SMA"
]
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Subtitle Extracts
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - []
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - Starting conversion.
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - FFmpeg command:
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - ======================
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - /usr/local/bin/ffmpeg -i /movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4.original -vcodec copy -map 0:0 -metadata:s:v title=FHD -metadata:s:v handler_name=FHD -c:a:0 ac3 -map 0:1 -ac:a:0 2 -b:a:0 256k -metadata:s:a:0 BPS=256000 -metadata:s:a:0 BPS-eng=256000 -metadata:s:a:0 title=Stereo -metadata:s:a:0 handler_name=Stereo -metadata:s:a:0 language=eng -disposition:a:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y /movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4
2020-11-25 06:10:57 - resources.mediaprocessor - INFO - ======================
2020-11-25 06:11:42 - resources.mediaprocessor - INFO - /movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4 created.
2020-11-25 06:11:44 - resources.mediaprocessor - INFO - Tagging /movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4 with TMDB ID 38695.
2020-11-25 06:11:44 - resources.metadata - INFO - Tagging file: /movies/Done/Monsieur Hire (1989)/Monsieur Hire (1989) Bluray-1080p [8-Bit][x264][AAC 2.0][TMDB-38695].mp4.
2020-11-25 06:11:45 - resources.metadata - INFO - Trying to write tags.
2020-11-25 06:11:45 - resources.metadata - INFO - Tags written successfully using mutagen.
2020-11-25 06:11:45 - resources.mediaprocessor - INFO - Relocating MOOV atom to start of file.
2020-11-25 06:11:45 - qtfaststart - INFO - Removing free atom at 32 (8 bytes)
2020-11-25 06:11:45 - qtfaststart - INFO - Patching stco with 113760 entries
2020-11-25 06:11:45 - qtfaststart - INFO - Patching stco with 113760 entries
2020-11-25 06:11:45 - qtfaststart - INFO - Writing output...
2020-11-25 06:12:00 - RadarrPostProcess - INFO - Radarr response Rescan command: ID 259882 queued.
2020-11-25 06:12:00 - RadarrPostProcess - INFO - Waiting rescan to complete
2020-11-25 06:12:10 - RadarrPostProcess - INFO - Final state: completed.
2020-11-25 06:12:10 - RadarrPostProcess - INFO - Rescan command completed
2020-11-25 06:12:10 - RadarrPostProcess - INFO - Requesting updated information from Radarr for movie ID 9024.
2020-11-25 06:12:13 - RadarrPostProcess - INFO - Radarr monitoring information updated for movie Monsieur Hire.
2020-11-25 06:12:13 - RadarrPostProcess - INFO - Radarr response Rename command: ID 259883 queued.

It looks like the following command is not being recognized: $SMA_CONFIG = "$SMA_PATH/config/autoProcess-French.ini";

Do you have any idea?

mdhiggins commented 3 years ago

This is still just a bash syntax error

export SMA_CONFIG=$(echo $SMA_PATH)/config/autoProcess-French.ini

No spaces around the = sign, include the export command, and if there's any spaces in the path then the path needs to be wrapped in quotes

Should be able to look up basic syntax yourself though

dramirvf commented 3 years ago

This is still just a bash syntax error

export SMA_CONFIG=$(echo $SMA_PATH)/config/autoProcess-French.ini

No spaces around the = sign, include the export command, and if there's any spaces in the path then the path needs to be wrapped in quotes

Should be able to look up basic syntax yourself though

Works like a charm!