#1 2014-03-24 11:46

erebus
Member
Registered: 2013-05-05
Posts: 36

Use music MP3 or FLAC to rename JPG album cover

hello
i have create  a lot a rule for my music with this at the end
D:\Download\[0Zic]\:ID3_Artist:\:ID3_Album:\

but my problem is that I have a picture (the cover of my album) who is with the mp3 and that is not stored with the mp3 or flac.

how to make the pictures or rename folder and which is moved with the mp3 or flac

I hope I was clear
thanks for advance
best regards

Offline

#2 2014-03-24 19:02

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Use music MP3 or FLAC to rename JPG album cover

Hello,

This can be achieved only with a help of PascalScript rule.

You can use the script below. When it comes across non MP3 file it will try to find a MP3 music file in the same folder and use meta data from it to construct the new name. You might want to adjust the constants TARGET_FOLDER and MUSIC_FILE_EXTENSION to suite your needs.

const
  TARGET_FOLDER = 'D:\Download\[0Zic]\';
  MUSIC_FILE_EXTENSION = '.mp3';
var
  FileExt: WideString;
  MusicFile, TagArtist, TagAlbum: WideString;
  MusicFiles: TStringsArray;
begin
  FileExt := WideExtractFileExt(FilePath);
  if not WideSameText(FileExt, MUSIC_FILE_EXTENSION) then
  begin
    SetLength(MusicFiles, 0);
    WideScanDirForFiles(WideExtractFilePath(FilePath), MusicFiles,
      False, False, False, '*' + MUSIC_FILE_EXTENSION);
    if Length(MusicFiles) > 0 then
    begin
      MusicFile := MusicFiles[0];
      TagArtist := CalculateMetaTag(MusicFile , 'ID3_Artist');
      TagAlbum := CalculateMetaTag(MusicFile , 'ID3_Album');
      if (Length(TagArtist) > 0) and (Length(TagAlbum) > 0) then
        FileName := WideIncludeTrailingPathDelimiter(TARGET_FOLDER) +
          TagArtist + '\' + TagAlbum + '\' + FileName
      else
        FileName := '?????';
    end
    else
      FileName := '?????';
  end;  
end.

Offline

#3 2014-03-24 20:05

erebus
Member
Registered: 2013-05-05
Posts: 36

Re: Use music MP3 or FLAC to rename JPG album cover

Hello
Thanks for your answer but is not working correctly this is my order rules and result
1. Your Pascal Script 
2. D:\Download\[0Zic]\:ID3_Artist:\:ID3_Album:\
My Result Is
D:\Download\[0Zic]\\\D:\Download\[0Zic]\Shaka Ponk\2014 - The White Pixel Ape\Folder.jpg

Or if i inverse the rules
My Result Is
D:\Download\[0Zic]\Shaka Ponk\2014 - The White Pixel Ape\D:\Download\[0Zic]\\\Folder.jpg

and the result i search is:
D:\Download\[0Zic]\Shaka Ponk\2014 - The White Pixel Ape\Folder.jpg


Is it possible the rename only the image folder in folder?

Last edited by erebus (2014-03-24 20:32)

Offline

#4 2014-03-24 21:02

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Use music MP3 or FLAC to rename JPG album cover

Please provide a few complete examples with full paths, for example:

From:
C:\Folder\File.ext
C:\Folder 2\File 2.ext

To:
C:\New Folder\New File.ext
C:\New Folder 2\New File 2.ext

Offline

#5 2014-03-24 21:33

erebus
Member
Registered: 2013-05-05
Posts: 36

Re: Use music MP3 or FLAC to rename JPG album cover

FROM:
i have no really path exactely but in genraly i rip my CD

D:\Download\[0Zic]\File.mp3
D:\Download\[0Zic]\i dont now.jpg

Or

When i download the music i have this (Folder = the name of the album and he is variable) ex:
D:\Download\Basil Poledouris - 1982 - Conan The Barbarian\file.mp3
D:\Download\Folder\File.mp3
D:\Download\Folder\i dont now.jpg

Or
D:\Download\Folder\Folder\File.mp3
D:\Download\Folder\Folder\i dont now.jpg

TO:
D:\Download\[0Zic]\Folder Artist Tag\FOLDER Album Tag\File.mp3
D:\Download\[0Zic]\Folder Artist Tag\FOLDER Album Tag\Folder.jpg

I was clear ??

Thanks

Last edited by erebus (2014-03-24 21:34)

Offline

#6 2014-03-24 22:08

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Use music MP3 or FLAC to rename JPG album cover

Ok, your other rules created a problem for non-MP3 files, they inserted "D:\Download\[0Zic]\\\" in addition to what the script inserted.

I've adjusted the script so that it will overwrite the full path to non-MP3 files, so now you can use it in combination with your existing rules (add it as the last rule in your list):

const
  TARGET_FOLDER = 'D:\Download\[0Zic]\';
  MUSIC_FILE_EXTENSION = '.mp3';
var
  FileExt: WideString;
  MusicFile, TagArtist, TagAlbum: WideString;
  MusicFiles: TStringsArray;
begin
  FileExt := WideExtractFileExt(FilePath);
  if not WideSameText(FileExt, MUSIC_FILE_EXTENSION) then
  begin
    SetLength(MusicFiles, 0);
    WideScanDirForFiles(WideExtractFilePath(FilePath), MusicFiles,
      False, False, False, '*' + MUSIC_FILE_EXTENSION);
    if Length(MusicFiles) > 0 then
    begin
      MusicFile := MusicFiles[0];
      TagArtist := CalculateMetaTag(MusicFile , 'ID3_Artist');
      TagAlbum := CalculateMetaTag(MusicFile , 'ID3_Album');
      if (Length(TagArtist) > 0) and (Length(TagAlbum) > 0) then
        FileName := WideIncludeTrailingPathDelimiter(TARGET_FOLDER) +
          TagArtist + '\' + TagAlbum + '\' + WideExtractFileName(FileName)
      else
        FileName := '?????';
    end
    else
      FileName := '?????';
  end;  
end.

Offline

#7 2014-03-24 22:54

erebus
Member
Registered: 2013-05-05
Posts: 36

Re: Use music MP3 or FLAC to rename JPG album cover

its Work perfect thanks
i have few question

1. Its posible the rename just the Image
FROM:
I dont Now.jpg

TO:
Folder.jpg

2. what changes can I do if the flac files

thanks again

Good Night

Offline

#8 2014-03-25 10:54

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Use music MP3 or FLAC to rename JPG album cover

1. Use filtering settings, or unmark non-JPG files. To use parent fodler name you meta tag :File_FolderName:.

2. To work with FLAC files change '.mp3' to '.flac', 'ID3_Artist' to 'FLAC_Artist', 'ID3_Album' to 'FLAC_Album'.

Offline

#9 2014-03-25 11:37

erebus
Member
Registered: 2013-05-05
Posts: 36

Re: Use music MP3 or FLAC to rename JPG album cover

1.I do not understand?
I really want to rename my image file
Folder.jpg
and not give the name of the parent folder

2. its work great thanks

Last edited by erebus (2014-03-25 12:42)

Offline

#10 2014-03-25 14:38

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Use music MP3 or FLAC to rename JPG album cover

I don't understand what you are trying to achieve with JPG files... examples?

Offline

Board footer

Powered by FluxBB