Jump to content
IGNORED

J River to HQPlayer


Recommended Posts

Hi all,

 

I have practically zero knowledge of writing .bat scripts for Windows; but I wondered if hqp-control could be used in some way to play from J River to HQPlayer. With some googling and trial and error I came up with a few lines that allow you to play any album from J River through HQPlayer (including from J Remote).

 

This is obviously a Windows only solution. The only thing it will do is play a complete album from beginning to end. It will also allow you to interrupt the currently playing album with another one. That's all. It's really a one trick pony :)

 

I'm hoping that someone with far better bat script skills them myself might be able to improve on it, since I really don't have the time.

 

You have to go to the tools menu in J R - options and click on files in the left hand column. Then for each file type in your library that is supported by HQPlayer and that you want to have played through HQP, choose the option to send to a custom application and navigate to the script linked below, wherever you've put it in your file system. Then click on oK.

 

From then on when you go the Albums view and click play on an album it should play through HQPlayer. Same when you choose to play an album with J Remote.

 

As I said, I hope someone here can make it into something better. For the moment it only suits the type of listener that likes to listen to complete albums at a time. Rather like me when I'm at home ;-)

 

https://dl.dropboxusercontent.com/u/86110007/software/jr-hqp-album.bat.zip

 

geoff

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment

I leave that as an exercise for someone with better bat scripting chops than me.

 

I think it should be possible.

 

All the receiving app (bat script in this case) get's from j river is the full path to the first file of the album selected for play. I chop off the file name and extension from the path and ask HQP to load all files from the album folder and start playing back from the first track.

 

It should be possible to copy the album folder to a ram disk first and load the new ram disk addreses of the files into hqp instead.

 

Someone more familiar with bat scripting than me could probably do it in the time it took me to write this post :-(

 

It might also be possible to convert non hqp supported formats to a supported format as I do with my iTunes Mac solution by calling an external program such as ffmpeg to do the conversion.

 

It may also be possible to allow the user to begin playback from an arbitrary track of the album rather than always beginning from the first track.

 

I think that would just about exhaust the possibilities given the limitations of the info past from j river when the send to external option is used.

 

It was probably originally intended for single video files that j river wasn't able to support. I'm just guessing though.

 

Geoff

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
  • 1 year later...
I wouldn't think so. Looks like the file association page has been that way for some time. HQplayer version matters, simply if it's installed in x86 or not.

 

Edit: I'm assuming my album-adding-to-end-of-playlist issue is due to hqp-control syntax changes since Geoff wrote this bat?

 

To make this easier for Geoff or Jussi to troubleshoot (or anyone else familiar with hqp-control) here is the bat:

@echo off

set datapath=%~dp1

IF %datapath:~-1%==\ SET datapath=%datapath:~0,-1%

TIMEOUT /T 2

start "" "C:\Program Files\Signalyst\HQPlayer Desktop 3\hqp-control.exe" localhost --stop

TIMEOUT /T 2

start "" "C:\Program Files\Signalyst\HQPlayer Desktop 3\hqp-control.exe" localhost --playlist-clear

TIMEOUT /T 2

start "" "C:\Program Files\Signalyst\HQPlayer Desktop 3\hqp-control.exe" localhost "%datapath%"

TIMEOUT /T 2

start "" "C:\Program Files\Signalyst\HQPlayer Desktop 3\hqp-control.exe" localhost --select-track 0

 

To reiterate, nothing in the playlist is clearing, but instead albums selected are adding to the end and then track 0 starts again.

Hi Ted,

I'll take a look and see if I can get it to work

I might try a Powershell script instead.

 

Best,

 

Geoff

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
The latest Windows version (3.15.1 beta 2).

I've been testing with the latest stable(non-beta) version and I can't recreate your problem.

 

As long as I just play an album from JR River (Media Centre 22) it works for me. When I ask Media Centre to play a new album playback is stopped and the previous one is always cleared from HQPlayer's playlist

 

Also tested with JRemote and that's working fine for me too.

Of course you have to associate each File Type with the .bat file in Media Center's Options -> File Types and it will only work with file types supported by HQPlayer. I assume though you've taken those factors into consideration.

 

You seem to have edited the path on the .bat file correctly, so I'm at a loss as to what could be causing the problems.

 

Can you try testing with the same version of HQP as me? 3.15 in case it's something to do with the beta.

 

The hqp-control.exe commands are very basic and have been working fine for me since at least from version 3.13.

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
OK, so I fell back to 3.15.0 (stable) and the intent of the bat seems to consistently work, but only when the current album music is stopped. If I try while playing: on some albums it works fine while playing, yet on others it does nothing (i.e. once the four dos command windows go away the oirginal album is there and starts playing again). In 3.15.1 (beta 2) the bat works fine, so far, when music is first stopped before selection. However, if selection happens while music is playing then 90% of the time the album is appended to the playlist. Overall, really, kind of a nice feature (but not a guarantee).

 

Again, I can't thank you enough for this idea. I hope bat masters get on it and add functionality, but the prize goes to you, Geoff. Thanks.

 

P.S. I have not tested JRemote but assume the same results.

You're welcome Ted and thanks for sharing your results.

 

My results still differ from yours as I don't need to wait for the currently playing album to stop playing. I just play a new album and it replaces the previous one and starts playing.

 

Strange that you're experiencing such different behaviour.

 

Just a thought; can you share with me where your albums are located? If you provide a file path to one of the albums which has the peculiar behaviour it might give me a clue.

 

Thanks

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
Afew things:

1) my JRIver is MC 20, build 133

2) both HQP and JR exist on my Windows 10 AO'd server (i7 6700k, 32GB RAM, etc)

3) all my music is on a shared folder in my Synology NAS (currently sharing a Diablo fiber switch with the HQP server), mapped to the server as drive M (multichannel is drive N but that is also a different library in JR). The music is divided by type in subfolders (directories really) like DSD, DSD128, hirez 24 bit, redbook, etc) and from there in album folders (named "artist-album"). I find no correlation to issues described above and album location (or format).

 

I don't see a correlation there either. I'm also using a Win10 server where HQP and JR coexist, though it's not AO'd.

I'm using a Synology NAS and have its music folder mapped to a drive (Z:).

 

Whether I load folder into JR from the mapped drive or using the full path name to the NAS music files, makes no difference. Of course I prefer the mapped shorter path names; but I just used the long name for a test.

 

I'm not sure if your use of MC20 as opposed to my MC22 would make any difference. I probably wrote the .bat while on MC20 anyway as it's quite old.

 

Perhaps a few other testers could weigh in? it might make it easier to pin down the problem.

 

Best,

 

Geoff

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
Stopping between each track makes transitions slow...

 

 

 

Instead of this sequence use "-q" parameter before the URI to queue it. So essentially just two things:

hqp-control localhost -q <uri>

hqp-control localhost --next

 

But you need to manage playback state, so if HQPlayer is stopped, call "--play" instead of "--next". This you parse from first value returned by "--state".

 

Thanks for the suggestions Miska. I think though you're under the impression that I'm loading individual tracks here. I'm actually only loading complete albums at a time. Unless I've misunderstood you.

 

As the title suggestions this is a very limited solution for people who are happy to load one album at a time. Even if you request JR to play from a different track, this will always result in the album playing from the first track in HQPlayer. I'm only loading the URI for complete albums.

 

When the user wants to change to a different album while an album is actually playing, I need to stop playback and clear, then load the new album. At least that's the only way I could figure out how to do it.

 

I was hoping someone would take this very simple .bat script and "run with it" creating something much better as .bat or Powershell script. I think it does have more potential.

 

At the moment it's only good for people who play complete albums at a time and don't need navigation within albums or playing playlists.

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
JRiver seems to be particular about what it will execute. On my system it will not execute powershell script unless I called that script via .cmd or batch file.

In case anyone is interested I converted Geoffery's batch script into powershell.

 

 

 

Rename call-jr-ps.cmd.txt to call-jr-ps.cmd

Rename jr.ps1.txt to jr.ps1.txt

 

In call-jr-ps.cmd file change the location to where you saved the jr.ps1 file (I have mine stored in subdirectory under download)

 

Change the location of External Program under Tools --> File Types for the files that you want HQPlayer to play.

 

[ATTACH=CONFIG]33304[/ATTACH]

 

Edit: If anyone know of a away to send stop/start/forward etc commands from JRiver to external program let me know and I will try to see if I can write the logic in to forward those commands over to HQPlayer.

 

It's great that you made a Powershell version, thanks. This could open up more possibilities.

 

One thing that was missing from my original instructions is that the argument: "[Filename]" needs to be passed to the script. This is entered by default in my version of Media Centre when I select an "External Custom" program to handle the file.

 

Ted, can you check that this argument is being passed to the script when you go to Options -> File Types and Choose the External custom program as in shadowlight's screen capture? I just want to check that you're passing this argument in case that's the cause of the problem.

 

Now there are a whole bunch of arguments that could be passed to the script instead of or in addition to "[Filename]". You can see these by right clicking in the field which contains the "[Filename]" argument.

 

By passing multiple different parameters to the script and adding conditional statements to deal with those parameters it may be possible to produce something with a lot more functionality.

 

Just a suggestion!

 

Regarding the idea of using Media Center's playback controls to control HQPlayer, I think that would involve playing the music files(s) in Media Center and HQP simultaneously and you probably don't want to do this. At the moment you could have Media Center set up to play to the same Audio Device as HQPlayer so that Media Center could take over playback for any non-HQP supported file formats.

 

I've only seen documentation for going in the other direction for controlling media center from an external app. This is what allows apps like JRemote to control it.

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
By the way, did MC have capability to act as a UPnP Media Server and Control Point? If that is the case, then one could use HQPlayer Embedded set up as UPnP Renderer and thus gain full playback functionality through JRiver, possibly even transcoding of file formats not supported by HQPlayer.

 

An interesting idea. I believe Media Center has those features so perhaps it would be the best solution for Media Center users.

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
  • 2 weeks later...

Just going back to the original simple, windows only, solution, I've managed to add some value to it :)

 

It is now possible to start playback from any desired track in an album. This means that navigation within the same album is possible. When using JRemote playback in HQPlayer should follow what you select for play in JRemote.

 

It will always clear and reload HQPlayer's playlist even when navigating within the same album. Even though this isn't the most efficient method, in practice the response is fast.

 

So if any of you are still using this simple Windows solution you may want to try this version.

 

Now that Ted has started a separate thread for the HQPlayer Embedded/Linux solution perhaps we can just keep this thread for the Windows only simple solution?

 

Thanks to shadowlight for deriving a powershell version from my original .bat script. My new version is a modified version of the powershell script. You will need this as well as my modified version of the .cmd file to make this work.

 

Note I've produced two versions of the ps script. The 'jrexp' version writes to a log file to aid in debugging. If you choose to use this version you will need to alter the path to the log file in the script. The path to hqp-control.exe now corresponds to where HQPlayer currently installs itself on Windows.

 

The three files are here:

https://dl.dropboxusercontent.com/u/86110007/software/JRiver-HQP.zip

 

This new version relies on the track numbers being the first two characters of the file name within the Windows file system. This is usually the case; but if any of your track naming in the file system doesn't correspond to this, playback from anything other than the first track will fail.

 

This method also does not currently take into account multiple discs within a single album where the naming scheme is "1-01" for disk one track one, "2-01" for disc two track one; etc. So only single albums are supported or box sets separated into single albums where the tracks are numbered 01, 02, 03… (If single numbers are used 1,2,3… that should also work) Or box sets which are organised into one big album.

 

Finally if you like playing back playlists from JRiver, this solution won't work for that. It's just album based. For playlists I suggest you export them to a .m3u8 file and load that manually into HQPlayer.

Geoff

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
Geoff,

Thanks for doing this. A couple questions:

1) both versions of ps script look identical (and both have log.text in them). What is the diff; I changed the path to the log file but no log exists so far.

2) although the local (to my server and HQP) JRiver works fine, the JRemote that talks to that JRIver works a bit weirdly. See screenshots. Although the 10CC album was picked, and is indeed loaded into HQPlayer (green highlighted boxes) and playing the correct track, my iPad's JRemote shows a different album in Now Playing (red highlighted boxes) and that album does not show up in any other player picked ( this device or something called Humax RVU Mediarenderer). Furthermore, the 10CC track does not decimate the elapsed time. And moreover, if I were to chose the 2L album in the now playing window and try to play track 4 HQPlayer would load it yet play track 1.

 

Update: I found the 2L album playing in the local JRIver but not in HQPlayer. I removed it. Now, when I pick an album from Jremote it loads in HQPlayer but does not load in JRiver, and therefore does not show in Jremote's Now Playing ("nothing is currently playing" is the message in any JRemote player). The picked album, like 10CC, shows in JRemote but does not activate any play or elapsed time icons, and does not show what song is playing. I have to look at my HQP (through RDC) to see that.

 

[ATTACH=CONFIG]33815[/ATTACH]

Thanks for your feedback Ted.

 

First of all I checked to make sure I sent both .ps files and they are different.

 

The jrexp.ps1 version will output to a log. You do need to change the .cmd file as well so that it points to this version.

 

jrexp.ps1 should help you in identifying any problems with albums that won't play.

 

As far as jremote and jriver are concerned this tool is behaving as expected.

 

It's purpose is simply to use jremote/jriver to say I want play this album through HQPlayer.

Or I want to play this album starting with whatever track I tap/double-click on in jremote/jriver.

 

jremote can only follow whatever is playing in Jriver and nothing is playing in Jriver. You have handed over to the external command which is "call-jr-ps.cmd" then in turn jr.ps1 or jrexp.ps1 soon as you choose to play an album or start from a track whose file format you've associated with the external custom command.

 

There is a disadvantage to this in that you can't follow HQPlayer's track progress in either jremote or jriver.

 

I also think there's an advantage though, because you are not using the resources on the machine JRiver is running on for JRiver to playback the track.

 

This also means there is no possibility for using the playback controls, Stop/Pause/Fast forward/Rewind/Next/Previous in JRemote or Jriver. Just select the Album or track from the album you want playback to begin from and that's it.

 

If you want to end a listening session just choose the last track from an album (and pick a short one) That track will stay in HQPlayer until the next listening sessions commences.

 

The other constraints are that this tool is relying on the filenames in the file system. Not on the tags that may be set in those files.

 

At the moment this means that track numbers can only be determined by the actual file names and the naming scheme is limited to track number in the format 01 …099

 

Any other file naming schemes will cause the tool to default to playing the entire album beginning with the first track.

 

So the following file naming schemes won't work:

 

1-1 or 1-01, 2-… ;etc. for multi disk sets.

1/, 2/ or 1., 2.; etc.

 

Only music files with the naming scheme beginning with the track number scheme 01 - 099 will work.

 

So there is room for improvement in these respects.

 

Hope it helps!

 

Geoff

jrexp.ps1.zip

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
  • 3 weeks later...

I have re-written this Powershell script from the ground up and now it is far less limited.

 

The main limitation to bear in mind is that there is no support for the playback controls; Stop, Pause, Resume, Next and Previous either from Media Center or J-Remote. Play is instigated from Media Center or J-Remote from whichever track you wish to play. All the tracks from that album are loaded or from the disk the track belongs to in a multi-disc (Box-Set). Then playback begins in HQPlayer from the track chosen for play in Media Center or J-Remote.

 

Full navigation is available by just selecting the track you want to play from the album. The album won’t be re-loaded in HQPlayer if it is already there. HQPlayer will simply play from the new track you just selected in Media Center or J-Remote.

 

As mentioned above multi-disk boxed sets which appear as a single album in Media Center are now supported and in that case only the disk of the current track you’ve chosen to play using Media Center will be loaded in HQPlayer.

 

I tested with a box-set consisting of 1,150 tracks. To work properly this relies on the naming scheme; “1-1 …50-8; etc. to identify it as a multi-disc album.

 

The actual disc number and track number though are supplied by J River itself. It turns out you can send more than one argument to an external app from J River; but this is sent as one string which I’ve comma delimited, so I can break it down when it arrives at my Powershell script.

 

After testing with numerous albums the one problem I encountered was with an album name that contained an ampersand (&). The filename was being cut at the ampersand, so of course, it didn’t work. 

 

I solved this by including a function in the string that’s passed to the external app from j River. The function simply replaces the ampersand with the ampersand preceded with the ‘^’ character. This is the “escape” character for BAT and CMD files.

 

If you come across any albums which don’t play it could be due to another character which causes problems that I haven’t come across in my testing.

 

The distribution includes a log file. Please send me this if you get any errors. If a character causes a problem as the ampersand did, hopefully I’ll also be able to solve it by similarly escaping the offending character in this function.

 

So this is the string that needs to be passed from J River to my Powershell script via the CMD file:

 

"Replace([Filename], &, ^&),[Disc #],[Track #]"

 

You’ll need to browse to the command file within the ‘File Types’ window within J River’s options. It’s the command file ‘CMD’ that J River needs to send the arguments to. When browsing to this CMD file you’ll need to choose ‘All Files(‘*’) within the ‘Select Filename’ dialog, else the CMD file won’t show up.

 

Then enter the above string in the ‘Arguments’ field after choosing ‘External Program (Custom)’ as the ‘Playback Method’

 

You’ll need to repeat this procedure for each of the File Types you wish to be played back by HQPlayer, instead of J River.

 

File types not supported by HQPlayer may now be played through HQPlayer via the creation of temporary files.

 

The temporary files will be created in the same location as the script itself. You can place this script anywhere you wish, including on a RAM Disk. So if you want the temporary files written to the RAM Disk that is where you’ll also want to install this script and all its associated files.

 

The last line in the CMD file is the path of the Powershell script. You will have to edit this to be the path where you have actually installed the script and all its associated files including this CMD file.

 

ffmpeg is used for the creation of the temp files and is included with this distribution. All the files including the ffmpeg folder must be kept in the same structure and relation as you received them in the distribution.

 

Note: For Apple Lossless files to work you will need to associate both ‘ALAC Audio (M4A)’ and ‘AAC Audio (m4a, aac, 3ga)’ to this script. Don’t ask me why. It’s the only way I could get it to work.

 

Finally you may want to edit a couple of lines in the Powershell script; ‘jrexp.ps1’ itself.

 

This will only be necessary if…

 

1/ You’ve installed HQPlayer in a non-standard location. Which means a location other than: ‘"C:\Program Files\Signalyst\HQPlayer Desktop 3\hqp-control.exe"

 

Currently this path is found at line 65.

 

Be careful doing this. Only alter the string within the quotation marks to reflect the correct path, then save the script.

 

2/ You want the temporary files created in a different format from ‘.flac’ (the default).

 

In that case you need to edit the line that reads $tempExt = '.flac' to reflect the format you want the temp files in, e.g. $tempExt = ‘.wav’ and save the script.

 

Obviously it takes a little longer for temp files to load in HQPlayer and for playback to begin, than for files which are in an HQPlayer supported format, which simply need to be loaded from their location in the file system.

 

Any temporary files that were created are deleted when a track from a new album is chosen for playback and replaced (where necessary) by the tracks from that new album.

 

That’s it! I hope some of you manage to get some fun out of this and please let me know if you have any comments/suggestions.

 

The distribution is here:

 

https://dl.dropboxusercontent.com/u/86110007/software/J River to HQPlayer.zip

 

Cheers,

 

Geoff

File Association.JPG

Browse to the cmd file.JPG

Choose the CMD file.JPG

Calling app.JPG

Place to edit path to hqp-control.exe.JPG

Place for editing temp file type.JPG

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment

Hi Ted, Yes that's correct, because I'm now getting the track number from J River's tags. So as long as the tags are set correctly the tracks should play.

 

This also has the advantage that wav and any other files can make use of this as they can all have tags within J River.

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment
5 hours ago, shadowlight said:

Wow.  I just took a look at the new script and you have put in a lot of effort.  Good job.

 

Does it make more sense to move the hqpctrl and hqpip variables to the top of the script with the other variables that are defined?  Moving them might make it easier for folks to change them instead of potentially messing up the script while trying to update.  Just my 2c :-)

Good idea, thanks and done!

jrexp.ps1

Owner of: Sound Galleries, High-End Audio Dealer, Monaco

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...