Tools and other software [Batch-Script] Music-Folder-Artist-Thumb-Creator (1 Viewer)

bta489

Portal Pro
March 17, 2013
127
64
Germany Germany
Country flag
Hi there,

I created a little Batch-Script that I'd like to share. It scans your Music-Folder and creates Folder thumbs for your Artists-Folders using your Mediaportal Thumbs-Folder. Additionally, you can choose if all thumbnails should be set as hidden.

So your Music Folder that may look like this
Before.jpg
might look like this
After.jpg

If the folder already contains a "folder.jpg"-File, it will be left unchanged. A log is created to keep track what the script did.

Instructions:
Save the .bat in your Music-Folder, run it and follow the instructions.
If you are using a custom Thumbs-Folder (other than "C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\Music\Artists") set it in the beginning of the .bat-File after "THUMBSFOLDER=" like this:
Code:
set THUMBSFOLDER=Q:\Some random\custom\path
.
You can also specify the Music-Folder in the .bat-File, so you can save the File somewhere else, in a similar fashion:
Code:
set MUSICFOLDER=M:\My Music Folder
For those two options please make sure that the path does not end with a backslash and is not encased in quotation-marks.

Code:
@echo off

:: Add the Path to your MediaPortal-Thumbsfolder (no backslash at the end)
set THUMBSFOLDER=
:: Add the Path to your Music-Folder  (no backslash at the end)
set MUSICFOLDER=

:: =======================================================================================
echo Music-Folder-Artist-Thumb-Creator (v1.0)
echo -- by bta489 ---------------------------
echo.


if NOT DEFINED THUMBFOLDER (
    set THUMBSFOLDER=C:\ProgramData\Team MediaPortal\MediaPortal\Thumbs\Music\Artists
    )
   
echo.

if NOT EXIST "%THUMBSFOLDER%" (
    echo Error!
    echo The specified Thumb-folder appears to not exist. Please check.
    pause
    goto :eof
)
if NOT DEFINED MUSICFOLDER (
    echo No Music-Folder specified, using "%cd%" instead.
    set /p NOFOLDER="Continue? (Y/N) "
    )
   
IF /I "%NOFOLDER%"=="y" (
    set MUSICFOLDER=%cd%
    )
IF /I "%NOFOLDER%"=="n" (
    echo Cancel Operation
    goto :eof
    )
   
if NOT EXIST "%MUSICFOLDER%" (
    echo Error!
    echo The specified Music-folder appears to not exist. Please check.
    pause
    goto :eof
)   
   
echo.
set /p INPUT="Hide all Thumbs? (Y/N) "


echo Start at %time% > %MUSICFOLDER%\log.txt
echo. >> %MUSICFOLDER%\log.txt

set /a NUMBEROFFOLDERS=0
set /a NUMBERIDLE=0
set /a NUMBERCOPIED=0
set /a NUMBERUNAVIALABLE=0

FOR /d %%a IN ("%MUSICFOLDER%\*") DO (
    set /a NUMBERFOLDERS+=1
    IF NOT EXIST "%%a\folder.jpg" (
        IF EXIST "%THUMBSFOLDER%\%%~nxaL.jpg" (
            copy "%THUMBSFOLDER%\%%~nxaL.jpg" "%%a\folder.jpg"
            IF /I "%INPUT%"=="y" attrib +h "%%a\folder.jpg"
           
            echo OK -- Artist: "%%~nxa"
            echo Artist: "%%~nxa" >> %MUSICFOLDER%\log.txt
            echo Result: Thumb successfully copied>> %MUSICFOLDER%\log.txt
            echo. >> %MUSICFOLDER%\log.txt
            set /a NUMBERCOPIED+=1
        ) ELSE (
            echo ?? -- Artist: "%%~nxa"
       
            echo Artist: "%%~nxa" >> %MUSICFOLDER%\log.txt
            echo Result: No Thumb available>> %MUSICFOLDER%\log.txt
            echo. >> %MUSICFOLDER%\log.txt
            set /a NUMBERUNAVIALABLE+=1
        )
    ) ELSE (
        IF /I "%INPUT%"=="y" attrib +h "%%a\folder.jpg"
        echo OK -- Artist: "%%~nxa"
       
        echo Artist: "%%~nxa" >> %MUSICFOLDER%\log.txt
        echo Result: Thumb already exists >> %MUSICFOLDER%\log.txt
        echo. >> %MUSICFOLDER%\log.txt
        set /a NUMBERIDLE+=1
    )
)

echo END at %time% >> %MUSICFOLDER%\log.txt
echo. >> %MUSICFOLDER%\log.txt
echo Folders processed: %NUMBERFOLDERS% >> %MUSICFOLDER%\log.txt
echo Thumbs copied: %NUMBERCOPIED% >> %MUSICFOLDER%\log.txt
echo Thumbs already present: %NUMBERIDLE% >> %MUSICFOLDER%\log.txt
echo Thumbs not found: %NUMBERUNAVIALABLE% >> %MUSICFOLDER%\log.txt

echo.
echo %NUMBERFOLDERS% Folders processed
echo -- %NUMBERCOPIED% Thumbs created
echo -- %NUMBERIDLE% already existed
echo -- %NUMBERUNAVIALABLE% were not found in Thumbs-Folder

pause
 

Attachments

Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

OP Similar threads Forum Replies Date
joEhSuper Issues with FilmInfo+ scraper script during import Moving Pictures 5
M [solved] IMDB script broken again General Support 67
Rob Hexenmeister Detect recording in progress from external script (AHK) General Support 8
horned_reaper [solved] When playing music Fanart does not shuffle Fanart Handler 20
horned_reaper [solved] When playing music Fanart does not appear immediately after downloading Fanart Handler 272
horned_reaper [Music] 5012: Start current music track from the beginning Improvement Suggestions 21
horned_reaper [solved] 5012: Restart current music track General Support 13
atlantic How to use Spotify inside Mediaportal? Listen Music 18
horned_reaper [solved] Music playback hangs General Support 58
globaldonkey Music Database Error Listen Music 1
joecrow Music on Headphones Listen Music 7
2BitSculptor MP 1.23.. music stops playing General Support 6
Sarxas What Music Are You Listening To? OffTopic 0
Edwardfc [solved] Mp 2.2.1 Configuration Issues - Goes to Sleep while playing Music General 6
G [fixed] [MP2-786] Party Music Player can only play playlists with less than 1000 items 2.2 Archive 7
KlausWirn Music crash Bass crash no change to play music Installation, configuration support 2
BlueMax1916 [confirm] Music: Every 2nd track skipped MediaPortal 2 30
N Music player help Listen Music 4
N How to shuffle all my music, and how to sort by album artist General 4
R MP 2.2 client spielt audio-titel kurz an und springt dann zum nächten Allgemeines Support- und Diskussionsforum 9
joecrow Music: Fade Out not working 1.20 Pre Release 0
M Music playback stops after certain files 1.19 0
E [Pending] Handling Multifile Cue Submit: code patches (MediaPortal/TV-Server/etc.) 56
X Music : WASAPI only plays one track then stops General Support 1
Top Bottom