#11 2014-03-25 18:30

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

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

A picture is worth more than all the words, this is what I want:

very bottom of the picture you can see that the image is renamed "folder.jpg"

Snap-2014-03-25-at-17_58_33_png-par-erebus.png

Last edited by den4b (2014-03-25 19:05)

Offline

#12 2014-03-25 19:05

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

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

Ok, I think I understand...

If you want change the filename of only JPG files to "Folder.jpg", add this script as the last rule:

const
  IMAGE_EXTENSION = '.jpg';
  IMAGE_TARGET_NAME = 'Folder';
var
  FileExt: WideString;
begin
  FileExt := WideExtractFileExt(FileName);
  if WideSameText(FileExt, IMAGE_EXTENSION) then
    FileName := WideExtractFilePath(FileName) +
      IMAGE_TARGET_NAME + FileExt;
end.

You might want to learn Pascal Script as it is a very powerful tool smile
http://www.den4b.com/wiki/ReNamer:Pascal_Script

Offline

#13 2014-03-25 19:36

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

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

is work great
thank you very much

I would like to learn PascalScript, but I do not speak English and have great difficulty in understanding I'll try, I'll try, but if you  had in french it would be nice

thank you very much again

Offline

#14 2014-12-21 21:46

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

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

den4b wrote:

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.

Hello
I duplicate this pascal script and change ".mp3" in ".flac" but my problem is when i insert a image with "mp3tag" in my ".flac" files, ReNamer have a error and a pop-up Warning with inside this:

Validation as failed due to issues with 13 failed

13 of which contains invalid characteres

Hint. you can check................................

but if a delete the image of My ".flac" files its work correctly.
I have no trouble with or without image in my "mp3" files

Thanks for advance
Best regards

Last edited by erebus (2014-12-23 06:32)

Offline

#15 2015-02-25 09:57

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

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

I do not understand the problem...

Please try to explain again and provide a complete example.

Offline

#16 2015-02-26 17:31

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

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

Hello
Sorry
I made a mistake this is not the right rule
i go back as this topik
http://www.den4b.com/forum/viewtopic.php?id=2064
the problem is similar

Sorry again

Last edited by erebus (2015-02-26 18:13)

Offline

#17 2018-11-12 05:55

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

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

Hello,

I have a problem again (Sorry) with this pascal script:

{ FLAC Folder Cover Music }
const
  TARGET_FOLDER = 'D:\Download\0Zic\';
  MUSIC_FILE_EXTENSION = '.FLAC';
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 , 'FLAC_Artist');
      TagAlbum := CalculateMetaTag(MusicFile , 'FLAC_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.

when now I use it, i have this alert:

preview process has been terminated due to a critical error:

Pascal Script Compile:
[Line 14] Error: Type mismatch

below the pascal script with red line 14 said incriminated

WideScanDirForFiles(WideExtractFilePath(FilePath), MusicFiles,
      False, False, False, '*' + MUSIC_FILE_EXTENSION);

i'dont understand. I hope i was clear.

thanks for advance
Best regards

Vincent

ReNamer Pro Version 6.9
Windows 10 entreprise 1803

Last edited by den4b (2018-11-13 06:36)

Offline

#18 2018-11-13 06:40

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

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

erebus wrote:

Pascal Script Compile:
[Line 14] Error: Type mismatch

The TStringsArray type has been deprecated and replaced by TWideStringArray type, since v5.74.4 Beta.

You need to adjust line 8:

MusicFiles: TStringsArray;

To:

MusicFiles: TWideStringArray;

Offline

#19 2018-11-13 11:37

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

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

Hello,

Thank you it's work perfect

Best Regards

Vincent

Offline

Board footer

Powered by FluxBB