HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: knilch on 2015-04-06 12:23:37

Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-06 12:23:37
For anyone that is looking for a possibillity to synchonize Foobar2000 items to different PMPs / MP3-players, Network paths, USB-sticks:
I had the same problem finding a solution for years and now did my own solution with FoobarSync.
Check out http://foobarsync.lima-city.de (http://foobarsync.lima-city.de) !

This thread here is for asking questions and feedback.
Title: FoobarSync - official disussion thread
Post by: alkasar on 2015-04-06 13:39:30
great
Will try one of these days.

There was an old plugin named "Send To Device" with almost same purpose, less flexible. Great that you rebuild something.
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-08 21:30:35
Think I better add some information so people can find it by forum search...

What it does
FoobarSync is an command line driven VBscript which will synchonize parts from your Foobar2000 Medialibrary and Playlists to one or more targets in a very flexible way.

Lets say you have a USB-Stick for your car entertainment system plus an Android device. Sure you want to have some music in your car and on your Android. But your car only accepts MP3 and needs a special folder-layout while your Android device plays many formats, but you want to save space and therefore want lower bitrates. And at least you want to have different albums and playlists in your car then on your Android. FoobarSync will help you to meet those demands plus more.

FoobarSync will get a subset of items from your Medialibrary AND your playlists, defined by a search-query and other rules. The selected items can be defined per target (one configuration file per target). This configuration file is stored in the root folder of the target. When synchronizing each item is checked against the defined rule sets and then a) copied to the target or b) converted to the target. If your subset (choosen items) in Foobar2000 changes, these changes will get synchonized as soon as you rerun FoobarSync.

Main features of FoobarSync, individual (per target/device):


Next version is ready for download: 0.9.2
   - fixed minor bug where processes did remain in memory.
   - optimized target preparation prior to analyse.
   - finished implementation of ""MinSpace""
   - implemented orphaned file count (needed for ""MinSpace"")
   - redesigned code for deletion of orphaned folders
   - improved statistic summary
   - many minor improvements
   - code cleanup

Title: FoobarSync - official disussion thread
Post by: 2tec on 2015-04-09 15:26:32
Think I better add some information

Thank you for the info and for developing and sharing this.
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-12 11:48:51
Question to Users of FoobarSync:
Could anyone please test sync with an iPhone / Android device connected via USB and give me feedback?
This is related to Wiki/Sync to Linux/Android (http://foobarsync.lima-city.de/wikka/Linux)
I would do it, but my Android is.. well.. special because it's rooted and I've many security thing done to secure data on it.

Thanks a lot!
Title: FoobarSync - official disussion thread
Post by: kbaerwald on 2015-04-13 09:58:18
I can't test the whole setup because after executing the script I get an error saying that it can't connect to the COM server. I have installed "foo_comserver2-0.7-setup.exe", started foobar2000 and executed the script (as admin). Foobar2000 is 1.3.8.

I am not familiar with MS Scripting - is there anything specific to do after the installation of the COM server?

P.S. Checked the foobar2000 preferences: Com server is running.

Code: [Select]
C:\Program Files (x86)\foobar2000>cscript sync.vbs tasks=mptr
Microsoft (R) Windows Script Host, Version 5.8
Copyright (C) Microsoft Corporation 1996-2001. Alle Rechte vorbehalten.
FOOBARSYNC 0.9.2 - Sync MediaLibrary and Playlists from Foobar2000 to tar
http://foobarsync.lima-city.de
Processing search for configuation files in root of drives D-Z...
*** PROCESSING 'L:\tutorial.id' (Synchronization tutorial)
Connecting to Foobar2000 Comserver / launch  Foobar2000 ...
ERROR:No connection to Foobar2000! Foobar Comserver not set up correctly?
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-13 17:04:03
Hi kbaerwald,

thanks for your feedback!
I'll try to help you solving this issue.



Please give feedback here if this solved your problem (with details) or not.
Thanks for sharing!
Title: FoobarSync - official disussion thread
Post by: kbaerwald on 2015-04-13 18:52:32
Hi knilch - here we go (thanks for your help)

  • As far as I can see you are running Windows 7, right?
    Right
  • Take a look into your foobar2000 -> preferences -> components. Does 'COM Automation Server 07 alpha 6' is listet as component?
    Yes - exactly
  • Have you tried to run the script when foobar2000 is running? I've had the problem, that foobar2000 did not start automatically on script execution.
    This is how I understood your tutorial - have foobar2000 running first then start the script - yes!
  • Some anti-malware software could block the COM Server. Check your log-files there if so.
    Running security essential only, do not see anything in the logs
  • You could try to reinstall COMserver with administrative privilleges (right-click setup-exe -> run as administrator).
    Yes - deinstalled and re-installed COM server with admin rights
  • Next thing to try: Register the server manually with the command line 'foobar2000.exe /regsvr:comserver2'
    Yes - tried it


I tried it a second time without starting foobar2000 first - hurrah it worked (see below). If the script invokes foobar2000 it starts and the script finds the COM server. I will continue to test and come back to you shortly!

Code: [Select]
*** PROCESSING 'L:\tutorial.id' (Synchronization tutorial)
Connecting to Foobar2000 Comserver / launch  Foobar2000 ...
Preparing target for analysis...
Processing 11 items in MediaLibrary...
Analysing 13 items in 1 playlists (out of 106 items in 3 pl
Searching target for ophaned files and folders...

ANALYSIS DONE: 'L:\tutorial.id':
Items that were ignored by rule..: 0
Items that were ignored by error.: 0
Ophaned files to delete..........: 0 (0 MB)
Existing items don't need action.: 0 (0 MB)
Copy queue - items to copy.......: 0 (0 MB)
Convert queue - items to convert.: 24 (69 MB ca.)
SUM OF AUDIO ITEMS AFTER SYNC....: 24 (69 MB ca.)

Free space now...................: 15248 MB
Free space after sync............: 15179 MB

You may now take a look on the target to check the file/fol
(you can disable this pause with parameter 'NoPause'

ENTER=continue with synchronization    S=STOP and quit >>
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-13 20:13:31
That's great!
I think the COM Server setup is a bit buggy. It would be interesting to see, what finally helped you to get it run. As I already said, I had some trouble with autostarting foobar2000 on script execution. Before, I also had no luck at all with the setup. But at least I managed to get it up 'n running on 2 different computers - but I have no idea how I managed that, haha!  !
What I can say for sure is: The COM server - once successfully set up - works reliable without negative impact to foobar2000 itself.
Title: FoobarSync - official disussion thread
Post by: Kluch on 2015-04-17 18:46:41
Hello! First of all THANK YOU FOR MAKING THIS PLUGIN!!! There are no other alternatives for syncing to a usb device. However I was wondering what is planned for a gui interface, maybe similar to the foo_dop plugin. I believe you would have a larger user base for the plugin as it would be more appealing and user friendly. I want to try the current build that you have with a flash drive before I rockbox my iPod classic and use this baby for my entire library. But once again thanks!
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-17 19:59:50
Hey Kluch!
Thanks a lot for requesting a GUI. As I have already written in the FoobarSync Wiki (http://foobarsync.lima-city.de/wikka), I would appreciate if anyone is willing to develop a GUI for my script!

I will focus my spare time on developing the pending changes (http://foobarsync.lima-city.de/wikka/PendingChanges) and some functional feature requests from future posts here. Reason is, that I've litte exerience in Visual Studio and other GUI-orientated develop environments.
I'm the command line / scripting oriented guy. I love to fullfill my personal - some times very special - needs in that way. My approach for FoobarSync was, that I wanted to have an target-individual synchronization, that can easily be triggert by any other application like schedulers or event handlers like 'USB-Device connected'. With the current release my personal needs are fullfilled. Because coding is a hobby, I will keep on tweaking and expanding functionallity.

The way I designed the script offers much opportunities to use it, also in foobar2000s' GUI.
Example: Use components ColumnsUI plus Run Command and simply add a button in foobar2000, that you can click to start sync to a connected device. Need support for this or other configurations? All it needs is to ask here for the way, how to solve a needed feature. I am sure, that forum readers will share their experience then. And if I (or someone) thinks the solution useful, this person may add a tutorial or similar to the Wiki. If it's a functional extension, it may take me just a few minutes to implement it. And I will do so, if I find it useful.

So keep on asking questions! 
Title: FoobarSync - official disussion thread
Post by: Kluch on 2015-04-17 21:02:11
Hey Kluch!
Thanks a lot for requesting a GUI. As I have already written in the FoobarSync Wiki (http://foobarsync.lima-city.de/wikka), I would appreciate if anyone is willing to develop a GUI for my script!

I will focus my spare time on developing the pending changes (http://foobarsync.lima-city.de/wikka/PendingChanges) and some functional feature requests from future posts here. Reason is, that I've litte exerience in Visual Studio and other GUI-orientated develop environments.
I'm the command line / scripting oriented guy. I love to fullfill my personal - some times very special - needs in that way. My approach for FoobarSync was, that I wanted to have an target-individual synchronization, that can easily be triggert by any other application like schedulers or event handlers like 'USB-Device connected'. With the current release my personal needs are fullfilled. Because coding is a hobby, I will keep on tweaking and expanding functionallity.

The way I designed the script offers much opportunities to use it, also in foobar2000s' GUI.
Example: Use components ColumnsUI plus Run Command and simply add a button in foobar2000, that you can click to start sync to a connected device. Need support for this or other configurations? All it needs is to ask here for the way, how to solve a needed feature. I am sure, that forum readers will share their experience then. And if I (or someone) thinks the solution useful, this person may add a tutorial or similar to the Wiki. If it's a functional extension, it may take me just a few minutes to implement it. And I will do so, if I find it useful.

So keep on asking questions! 


Okay thanks!!! Also I'd love to help but I have very little coding background (basic Java) and don't really know gui integration either. But once again, huge contribution!!! Thanks
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-04-18 10:18:48
New Version 0.9.5 released!
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-05-03 11:44:15
Version 0.9.8 is out with major changes and improvements.
Several changes in configuration file sections were made.
If you update from older version make sure to check out the changelog
and take a look at 'tutorial.id' in downloaded zip-file.

Title: FoobarSync - official disussion thread
Post by: erzadel on 2015-05-28 04:33:59
Ahhh, thank you so much for this plugin! It works swimmingly with my Rockbox'd iPod. I'm so happy with it! Thank you again for your hard work.

Just a quick side note, I had a couple of problems performing the test analysis for the first time. This is what would happen:

(https://cdn.pbrd.co/images/N0KAdWu.png)

After poking around, I realized that I didn't have the proper permissions to read/write to my iPod and that it didn't like certain playlist names. I only figured this out by poking around the code and printing out stuff to the console. Is it possible to implement error messages? Or did I somehow miss something in the documentation that covers these issues? Many apologies if that is the case.

Also, I'm not an expert when it comes to tagging so sorry for my ignorance. I have a lot of Arabic, Korean, Mandarin, and Japanese songs. After syncing, a lot of the files names don't show any foreign characters at all. How do I know if the files are tagged/named using Unicode and how do I make sure it's in Unicode?

Once again, thank you a billion times!
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-05-28 09:28:18
After poking around, I realized that I didn't have the proper permissions to read/write to my iPod and that it didn't like certain playlist names. I only figured this out by poking around the code and printing out stuff to the console. Is it possible to implement error messages? Or did I somehow miss something in the documentation that covers these issues? Many apologies if that is the case.


erzadel,
Also, I'm not an expert when it comes to tagging so sorry for my ignorance. I have a lot of Arabic, Korean, Mandarin, and Japanese songs. After syncing, a lot of the files names don't show any foreign characters at all. How do I know if the files are tagged/named using Unicode and how do I make sure it's in Unicode?


Hope this helps! Because I am German I do not have much experience with unicode - so any feedback about your issues is welcome.
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-05-28 22:21:30
For the Whitelist I've found following:

"The secret to making Unicode regular expressions manageable lies in the \p[category] construct, which matches any character in the named Unicode character category...The high-level Unicode categories are Letters (L), Marks (M), Numbers (N), Punctuation (P), Symbols (S), Separators (Z), and Others (O and C)"

So \p{L} for example will match any Unicode letter character.

Please give feedback about this hint.
Title: FoobarSync - official disussion thread
Post by: faemir on 2015-06-07 15:02:41
Thanks for making this script - something I've needed for ages!

Unfortunately I'm falling over on the tutorial, where I get this error:

ERROR:CreateFLAGfile: Access denied: 'c:\ConvertJobFlag.1'

Presumably the script doesn't have write access to c:\ - Can I make the script use elsewhere as a temporary store? I'd rather not let it use the root of my main drive.
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-06-16 17:51:18
The changes you asked for are done in a the new release:




Title: FoobarSync - official disussion thread
Post by: faemir on 2015-06-16 18:19:18
The changes you asked for are done in a the new release:

  • minor bug fixed: nopause caused script so pause endless
  • Flagfiles for conversion control have moved from c:\ to folder where sync.vbs is executed
  • ffprobe.log has moved from c:\ to folder where sync.vbs is executed
    (used if parameter #5 of ConvertFormats (http://foobarsync.lima-city.de/wikka/ConvertFormats) has value '?')


Fantastic - this works perfectly now, and i'm busy filling up my mp3 player. Thanks!
Title: FoobarSync - official disussion thread
Post by: confuzius on 2015-09-04 23:46:32
Wow!!!!!

First let me say, coming from a 20 year developer, that looks like a whole world of pain.

The fact you were able to put that script together, I can't imagine how good you would actually be in a proper modern development environment.

I think as you maintain this, you will learn the lessons first hand which led to the development of modern development tools.

I wish you the best of luck in your maintenance.

I pass the following command line and it still processes the playlists. Am I missing something?

cscript sync.vbs task=mt runid="G:\"
Title: FoobarSync - official disussion thread
Post by: confuzius on 2015-09-05 02:03:05
I pass the following command line and it still processes the playlists. Am I missing something?

cscript sync.vbs task=mt runid="G:\"


Figured it out. I was using task instead of tasks.

You may want to consider throwing an exception if an unrecognized parameter name is passed in.

Cheers, and again wow!
Title: FoobarSync - official disussion thread
Post by: omgiafs on 2015-10-03 10:44:37
Hi!
Thanks for a such handy tool!

I have a "little" trouble. My situation:

1. Audio files at network attached storage (NAS) and albums are SINGLE *.ape or *.flac or something other with *.cue. So i dont want to waste my HDD with files, which i already have at NAS. Nevermind when this single lossless files located, i think...
2. Foobar2k playlists created with cuesheet usage
3. When i try to sync playlists, there is error in ffprobe.log:
Code: [Select]
ffmpeg started on 2015-10-03 at 16:03:37
Report written to "c:\Program Files (x86)\foobar2000\ffprobe.log"
Command line:
"c:\\Program Files (x86)\\foobar2000\\ffmpeg.exe" -y
-i "H:\\synctest\\Iron Maiden\\Studio Albums\\1992 - Fear Of The Dark (TOCP-7155)\\Iron Maiden - Fear Of The Dark (TOCP-7155).cue" -vn
-c:a libvorbis -ac 2 -q:a 5 "I:\\/MUSIC\\Heavy Metal\\Iron Maiden\\1992 - Fear Of The Dark (TOCP-7155)\\12 - Fear Of The Dark.ogg"
ffmpeg version N-75573-g1d0487f Copyright © 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype
--enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs
--enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  2.100 / 55.  2.100
  libavcodec    57.  3.100 / 57.  3.100
  libavformat    57.  2.100 / 57.  2.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter    6.  9.100 /  6.  9.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample  2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input file with argument 'H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\
Iron Maiden - Fear Of The Dark (TOCP-7155).cue'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'libvorbis'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '2'.
Reading option '-q:a' ... matched as option 'q' (use fixed quality scale (VBR)) with argument '5'.
[b]Reading option 'I:\/MUSIC\Heavy Metal\Iron Maiden\1992 - Fear Of The Dark (TOCP-7155)\12 - Fear Of The Dark.ogg' ... matched as output file.[/b]
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\Iron Maiden - Fear Of The Dark (TOCP-7155).cue.
Successfully parsed a group of options.
[color=#FF0000][b]Opening an input file: H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\Iron Maiden - Fear Of The Dark (TOCP-7155).cue.
[AVIOContext @ 03e2eac0] Statistics: 1682 bytes read, 0 seeks
H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\Iron Maiden - Fear Of The Dark (TOCP-7155).cue: Invalid data found when processing input[/b][/color]

Test playlist and playlist item properties here (https://imgur.com/a/5SDFk).

I think we need to parse .cue. FFMpeg can't extract one track from .flac even we have parameters from playlist item (file path, duration, referenced file and referenced offset), as i know.
So we need multiformat tool which can extract single track from lossless containers such as  WAV, FLAC, APE, LossyWAV, ALAC, TTA, and WavPack  And this tool must do it from CLI. Cuetools can't do this as i know...

Please, help! I don't want to convert all albums i have to a single files, because it downloaded with torrent and seeding now...

P.S. Sorry for my bad English.
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-10-05 11:14:01
omgiafs,

I am sorry but processing a CUE-file is out of scope for this project.
I suggest you look for a tool that cuts the big flac-file into tracks. I bet ffmpeg IS able to do this but there should be some tools with GUI out there.
After you have single files, you will be able to use FoobarSync the usual way.

Good luck!
Title: FoobarSync - official disussion thread
Post by: matzekatze on 2015-11-22 00:06:39
Hey,

thanks a lot for foobarsync. That's exactly what I am looking for. I am using foobar2000 (which works really good in wine (windows emulator) on Ubuntu. Now Im trying to get foobarsync to work in wine as well. Seems like something goes wrong but I have no clue what it is.

com automation server seems to be installed (according to foobars component list)

I am able to start cscript.exe in cmd. but when I go to foobar's directory and try to run "cscript sync.vbs tasks=mptr" nothing happens. No error occurs, nothing. There is just the next line with the blinking cursor waiting for me to type my next command.

Any clue whats going wrong?

EDIT
Okay, found a solution: Somehow it doesn't work for me to go to foobar's directory and then use cscript. It is also possible to stay in C:\windows\system32 with the following command (quite simple...): cscript "C:\Program Files (x86)\foobar2000\sync.vbs" tasks=mptr
Title: FoobarSync - official disussion thread
Post by: matzekatze on 2015-11-25 11:21:44
Hey,

im still trying to get FoobarSync to work. After I finally edited my config, I wondered why nothing is copied to my specified destination. Only the FLAG files were copied and not deleted. I recognised as well that it is not possible to see any analysis results like it should. Seemed like the script ended too early without any error message even with Debuglevel=5...

Only after I changed the tasks from "mptr" to "mpt" and added a runid="L:\" cmd had an error for me:

Code: [Select]
C:\windows\system32>cscript "C:\Program Files (x86)\foobar2000\sync.vbs" tasks=mpt Debuglevel=5
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

FB-Home is:C:\Program Files (x86)\foobar2000


FOOBARSYNC 0.9.9 - Sync MediaLibrary and Playlists from foobar2000 to targets
http://foobarsync.lima-city.de

*** PROCESSING 'L:\foobarSYNC.id' (SansaClip+)
    OPTIONS..: TEST, MediaLibrary, Playists

  Preparing: setting attributes on target...
  Medialib.: there are 14424 items in Medialibrary
  Medialib.: analysed 3 items in 30.11.1999 00:00:02 (3 items/s)
  Playlists: there are 55 playlists with 42566 items in foobar2000
C:\Program Files (x86)\foobar2000\sync.vbs(175, 2) Microsoft VBScript runtime error: Invalid procedure call or argument: 'left'


I looked for the indicated argument:
   
Code: [Select]
[#175] wscript.StdOut.write s&left(SCstr,79-len(s))&left(BSstr,79-len(s))

and after I changed it to
Code: [Select]
[#175] wscript.StdOut.write s


the analysis shows up and Im even able to copy tracks to the specified destination.

I dont know what the left-argument is about. Is it necessary? Why is it buggy? Help is appreciated. Thanks:)
Title: FoobarSync - official disussion thread
Post by: knilch on 2015-11-26 11:31:57
Hi matzekatze! Guess you found a bug 

I dont know what the left-argument is about. Is it necessary? Why is it buggy? Help is appreciated. Thanks:)

Line #175 gives any (!) output to the console. I gave the script a very fancy output like progress calculations and so on, thats why it is quite difficult to guess whats going wrong.

If you like to help to find the error, do the following modifications and send me the output via PM.
Script should aferwards look like this:
Code: [Select]
[#175] wscript.StdOut.write "~"&s
[#176] wscript.StdOut.write s&left(SCstr,79-len(s))&left(BSstr,79-len(s))

Thank you.
Title: Re: FoobarSync - official disussion thread
Post by: stevehero on 2022-04-09 21:23:19
Thanks for this.

Does this work with a portable install. I cannot seem to connect to the Comserver or do I install the server to the portable path. I'm afraid to do this as there's already a COMServer2Helper.exe file in there.

Here's the output from: cscript sync.vbs tasks=mptr

Code: [Select]
W:\Apps (Portable)\Music Apps\foobar2000>cscript sync.vbs tasks=mptr
FB-Home is:W:\Apps (Portable)\Music Apps\foobar2000

FOOBARSYNC 0.9.9 - Sync MediaLibrary and Playlists from foobar2000 to targets
http://foobarsync.lima-city.de

Searching for configuation files in root of drives D-Z...
*** PROCESSING 'D:\tutorial.id' (Synchronization tutorial)
WARNING:No connection to foobar2000! Foobar Comserver not set up correctly?
FOOBARSYNC ENDS NOW.

W:\Apps (Portable)\Music Apps\foobar2000>
Title: Re: FoobarSync - official disussion thread
Post by: knilch on 2022-04-10 10:04:52
Does this work with a portable install. I cannot seem to connect to the Comserver or do I install the server to the portable path. I'm afraid to do this as there's already a COMServer2Helper.exe file in there.

Hello Stevehero,

I stopped development of "Foobar-Sync" with Version 0.9.9 but I still use my tool to assemble and sync audiofiles & playlists across multiple devices.
Because I don't have any additions/changes to my media-files anymore, I am still at Foobar V.1.3.7 (portable).
So my usage is limited to Foobar-Sync and management of the media I like to sync.

I think there were significant changes after 2015 in the Foobar API and the way developers can add code. Existing plugins had a problem in theese days and many developers rejected to obey the new rules.
Therefore I am not sure if Foobar-Sync can run at newer versions.

BUT:
If
"COM Automation Server" (foo_comserver2) can run with newer Versions, all should be fine.

So we should focus on COMServer !


Also I found a note about issues in my chaos. The snipples seems from here: https://hydrogenaud.io/index.php?topic=39946.0
Quote
Known installer issues

The uninstallation function fails to remove some information from the registry. The following batch file can be used to remove the entries in question from the registry:

Code: [Select]

reg delete HKCR\TypeLib\{CB8F14D8-736E-4BB7-ADCF-BE26C39B576B} /f
reg delete HKCR\CLSID\{1bffc1e4-21a6-45af-8831-5ee045281633} /f
reg delete HKCR\Foobar2000.Application.0.7 /f

Coming back to your issue I would try following things:

Please try that first and report back.

Good luck!
Andreas
Title: Re: FoobarSync - official disussion thread
Post by: stevehero on 2022-04-10 11:03:15
Thanks for the reply.

I've created a new portable install and found that it is indeed the whitespace in the path that is the issue.

This worked:
C:\Users\username\Desktop\foobar2000

This did not:
C:\Users\username\Desktop\foobar2000 space
Title: Re: FoobarSync - official disussion thread
Post by: stevehero on 2022-04-10 12:41:05
Just a few questions:

1. Is there a way to convert lossless files only and transfer mp3 over? My files are either FLAC or MP3.
 
2. I don't seem to get how the convertFormat sections works and how to set it up for FLAC to MP3.
Currently, the file that appears in the folder is:
    filename_q2.OGGFLAG

I've taken a look at https://foobarsync.lima-city.de/wikka/SyncRules but can't quite understand how to set it up for my needs.

3. Is there a way to embed the folder.jpg that resides in the folder where the file is? I know this can be done with metaflac.exe --ti "pathto/folder.jpg"
Title: Re: FoobarSync - official disussion thread
Post by: knilch on 2022-04-10 19:29:17
1. Is there a way to convert lossless files only and transfer mp3 over? My files are either FLAC or MP3.
Code: [Select]
SyncRules=FLAC*0*MP3_160
SyncRules=*0*copy

Read on to understand the two lines.

2. I don't seem to get how the convertFormat sections works and how to set it up for FLAC to MP3.

Example:
Code: [Select]
SyncRules=$if($greater($strstr(%KNI_SYNC%,'Wecker'),0),'T')*0*Vorbis_q2
SyncRules=IT*0*copy
SyncRules=MOD*0*copy
SyncRules=669*0*copy
SyncRules=XM*0*copy
SyncRules=*<115*copy
SyncRules=*>115*Vorbis_q2

Important:
Syncrules are processed from top to buttom.
The first matching for the processed item will decide what ConvertFormats is used.

The example above reads as follows:
$if($greater($strs   ... shows that very complex things are possible. Just ignore for the moment. :-)
Files from media lib with extensions IT, MOD, 669 or XM will just be copied.
All other files than theese will be copied if bitrate is < 115kbit.
Rest of files (with more than 115 kbit bitrate) will be converted to Vorbis codec with profile "Vorbis_q2" (see below).

profile Vorbis_q2
Code: [Select]
ConvertFormats=Vorbis_q2*OGG*-vn -c:a libvorbis -ac 2 -ab 96k*96*_q2

The stars (*) are used as delimiters. The meaning of the arguments are descibed in the Wiki (https://foobarsync.lima-city.de/wikka/SyncRulesIDfile).
Most of this stuff is related to ffmpeg, that does the conversion.
It's not easy to get it all setup but thats the price you pay for the flexibility you get.  ;)

Here some more examples for ConvertFormats:
Code: [Select]
ConvertFormats=MP3_128*MP3*-vn -ac 2 -ab 128k*128
ConvertFormats=MP3_160*MP3*-vn -ac 2 -ab 160k*160
ConvertFormats=MP3_192*MP3*-vn -ac 2 -ab 192k*192
ConvertFormats=MP3_256*MP3*-vn -ac 2 -ab 256k*256
ConvertFormats=Vorbis_q4*OGG*-vn -c:a libvorbis -ac 2 -ab 128k*128*_q4
ConvertFormats=Vorbis_q5*OGG*-vn -c:a libvorbis -ac 2 -ab 150k*150*_q5
ConvertFormats=OPUS_96*-vn -c:a libopus -ac 2 -ab 96k*96
ConvertFormats=OPUS_128*OGG*-vn -c:a libopus -ac 2 -ab 128k*128
ConvertFormats=AAC_HE_80*AAC*-vn -c:a libvo_aacenc -profile:a aac_he_v2 -ac 2 -ab 80k*80

Currently, the file that appears in the folder is:
    filename_q2.OGGFLAG

Theese FLAG-files are just placeholders for the conversion and disappear when sync is finished.
They are used to judge if an item in a playlist must be copied to PLSyncBaseDir.
So if an item is already in MLSyncBaseDir synced it will not get copied to PLSyncBaseDir. Instead the playlist will just link the item to the existing file.

3. Is there a way to embed the folder.jpg that resides in the folder where the file is? I know this can be done with metaflac.exe --ti "pathto/folder.jpg"

Not with FoobarSync directly but you are on the right way. If you embed the album cover into the FLAC-files and tell FoobarSync to just copy, it will contain your cover as no modifications to copied files are made. If an embedded album cover will survive conversion from one format to another is a question of the converter used: ffmpeg.

Could you do me a favour and tell me what version or Foobar you are running?
I'd like to update my wiki that it runs with newer versions and add the path-issue with comserver2.
Thanks  :D
Title: Re: FoobarSync - official disussion thread
Post by: stevehero on 2022-04-10 23:38:24
This is great. One baby step closer.

I'm running the latest and greatest v1.6.10. So it seems that this is running just fine minus the whitespace thing. I'd say that would be easily fixable. I wonder if that is still maintained by anyone?

Btw, this link you posted is empty: https://foobarsync.lima-city.de/wikka/SyncRulesIDfile/backlinks

So, for artwork embedding. I've written this command separately to see if embedding artwork is possible and in itself will do that with the folder.jpg file and convert to a 320kbps MP3.

Code: [Select]
ffmpeg.exe -i input.flac -i folder.jpg -ab 320k -map 0:a -map 1:v -map_metadata 0:g:a:0 -c:v:1 jpeg -c:v:0 copy -disposition:v:1 attached_pic -metadata:s:v:1 title="Album Cover" -metadata:s:v comment="Cover (Front)" -id3v2_version 3 out.mp3

But, there's always a but!!, this doesn't work.
Code: [Select]
ConvertFormats=MP3_320*mp3*-i folder.jpg -vn -ac 2 -ab 320k -map 0:a -map 1:v -map_metadata 0:g:a:0 -c:v:1 jpeg -c:v:0 copy -disposition:v:1 attached_pic -metadata:s:v:1 title="Album Cover" -metadata:s:v comment="Cover (Front)" -id3v2_version 3*320

Is this because I'm trying to pipe another file with the -i switch? Or is it failing because the current directory when converting is not that of the file?

Title: Re: FoobarSync - official disussion thread
Post by: knilch on 2022-04-11 11:20:33
Yes, link was not correct.
SyncRules are described here (https://foobarsync.lima-city.de/wikka/SyncRules).

I think embedding the cover at conversion-runtime via SyncRules is not possible, because my script simply wasn't built to do this.

As I wrote you could try to store the cover in the original file, that is listed in your Foobar.
You could write a script yourself to do that.
But: I don't know if the cover will survive conversion. Just test that and see if cover is still there in the destination file.
If it doesn't survive, you could configure the SynRule to COPY instead of convert.

Note:
Yesterday I sent a hour to update my installation to newest release of Foobar2000.
Beside some component-troubles I managed to update with all exisiting configuration and components.
I am happy to know, that my script is still fully functional with the current release.

Answer to your other questions:

Yes, Foobar2000 is still maintained.

The whitespace-issue comes from COMserver component. So it's up to the developer of this comonent to fix it.

Yes, I am pretty sure folder.jpg would be searched in yout Foobar2000-folder because my script operates from the installation path and access to media is done by full path of the items.
Without futher development I see no chance to cover your needs for embedding covers at conversion.

If someone wants to implement that, feel free! :-)
Title: Re: FoobarSync - official disussion thread
Post by: stevehero on 2022-07-10 14:02:16
Just wondering if this can use a DSP chain when converting? I looked at the code and I can't see anything there that shows it can.
Title: Re: FoobarSync - official disussion thread
Post by: knilch on 2022-07-11 11:00:16
No, I see no change to route encoding via DSP.
Encoding is done with ffmpeg.