memen45 / SubMusic

Sync music and podcasts to your Garmin watch from your own SubSonic or Ampache server
GNU General Public License v3.0
110 stars 11 forks source link

"Radio Stations" in Ampache #26

Open GMGassner opened 2 years ago

GMGassner commented 2 years ago

Hi all, thanks for your great work on this project. I have a small question/request. Can I stream music via the "Radio Stations" in Ampache? I love Internet Radio und can't seem to find a way to get these working. Version: Ampache 4.4.3-release Thank you very much.

best regards

GMGassner commented 2 years ago

Thanks for the reply. Which kind of info do you need?

GMGassner commented 2 years ago

image This section of Music is meant by "Radio Stations". I can not use playliste because these can only hold permanent objects.

memen45 commented 2 years ago

Not sure if it is possible to stream live radio. You would need a wifi or Bluetooth connection throughout your activity, so then you would have to bring your phone? And if you bring your phone, you might as well connect your head/earphones directly to your phone.

Or do I misunderstand your idea?

GMGassner commented 2 years ago

Not sure if it is possible to stream live radio. You would need a wifi or Bluetooth connection throughout your activity, so then you would have to bring your phone? And if you bring your phone, you might as well connect your head/earphones directly to your phone.

Or do I misunderstand your idea?

You have not misunderstood the idea, it is exactly what I what to do. You also have a point by saying, " you might as well connect your head/earphones directly to your phone.", but i want to illustrate why it could be a asset. In my gym we have WiFi everywhere. When you are mid workout it can be difficult to quickly grab the phone or change station when you are rowing, swimming or up on a bolder wall. Also in the SPA area, everything with a camera is strictly forbidden for privacy reasons. This situations all happened often (especially the SPA one) and i wished to be able to just use my Venu 2 for this matter. If i can help in any way to implement this feature would be nice.

memen45 commented 2 years ago

Ah okay, yes that makes sense!

Of course any help is welcome and much appreciated, especially since I am short of time coming weeks. The following is for reference when I have some more time to look into it.

Research:

Implementation:

GMGassner commented 2 years ago

Thank you for considering my enhancement.

I will try to also be a helping hand as far as I'm able to.

Research:

Name Value Since Description
ENCODING_INVALID 0 API Level 3.0.0 Invalid encoding type
ENCODING_ADTS 1 API Level 3.0.0 ADTS audio encoding type
ENCODING_MP3 2 API Level 3.0.0 MP3 audio encoding type
ENCODING_M4A 3 API Level 3.0.0 M4A audio encoding type
ENCODING_WAV 4 API Level 3.0.0 WAV audio encoding type

I guess MP3 is relevant and may be M4A, the other two are edge cases in my experience. (never seen a ADTS or WAV Station)

Implementation:

memen45 commented 2 years ago

From the Ampache API docs I cannot find any reference to the radio stations feature, so I am not sure whether the feature is fully supported yet by Ampache. I have opened an issue: Ampache/Ampache#2987. Also as far as I know the Nextcloud music app does not support this feature (yet).

I think - but this depends on Ampache API specs too - the SubMusic app could use the HTTP_RESPONSE_CONTENT_TYPE_HLS_DOWNLOAD, but this would of course require testing.

memen45 commented 2 years ago

Unfortunately, for now we have to wait as the radio stations feature has not yet been implemented in the Ampache API.

Looking forward to see SubMusic support radio stations in the future and thanks a lot for bringing in the idea!

GMGassner commented 2 years ago

Unfortunately, for now we have to wait as the radio stations feature has not yet been implemented in the Ampache API.

Looking forward to see SubMusic support radio stations in the future and thanks a lot for bringing in the idea!

I tried to find a workaround with Ampache API, but regarding this API we really have to wait. Is there anything holding back a SubSonic implementation? From what i saw it might be feasable and you can use SubSonic API in Ampache as a fallback. Which would make it work. If you are interestet in creating a SubSonic API Internet Radio plugin I would try to gather as much information as I can. Maybe assist coding if you allow it (but i only know Python and a little Java).

memen45 commented 2 years ago

Most of the Monkey C is just a simple version of javascript with some specifics or workarounds to get things working. Implementation should be possible I think. I am also thinking now that streaming could be implemented for all resources. In case you have wifi available, you might as well stream songs instead of waiting for the whole sync to complete. At least the subsonic API seems to support this (HLS, not sure about Ampache though).

Not sure if it is possible to download files while not in Sync mode (iirc this was not possible, but might have changed). Also I have not tested HLS streams at all, so not sure how they behave.

Unfortunately, I will not have time to work on this shortly. Of course help is appreciated and I can review PRs and give feedback if needed! I will make a separate issue for the 'streaming everything' idea, as it is different from this one.

GMGassner commented 2 years ago

Most of the Monkey C is just a simple version of javascript with some specifics or workarounds to get things working. Implementation should be possible I think. I am also thinking now that streaming could be implemented for all resources. In case you have wifi available, you might as well stream songs instead of waiting for the whole sync to complete. At least the subsonic API seems to support this (HLS, not sure about Ampache though).

Not sure if it is possible to download files while not in Sync mode (iirc this was not possible, but might have changed). Also I have not tested HLS streams at all, so not sure how they behave.

Unfortunately, I will not have time to work on this shortly. Of course help is appreciated and I can review PRs and give feedback if needed! I will make a separate issue for the 'streaming everything' idea, as it is different from this one.

Thank you very much for esaclating to 'streaming everything'. I wanted to propose that, but I thought it would be to difficult or ridiculous. But It Would love it to have WiFi enabled, logged in at the gym and just listen to my favorite internet radio station. Like a .m3u or .pls streamer.