25huizengek1 / ViTune

An Android application for seamless music streaming
https://vitune.app
GNU General Public License v3.0
338 stars 21 forks source link

Desktop App #190

Open Geigerkind opened 6 months ago

Geigerkind commented 6 months ago

Hey! Thank you for maintaining this app and adding nice and useful features!

I wanted to ask if you are planning to create a Desktop App (preferably for Linux) as well or some way to run this app on the desktop.

I am using my computer during the day a lot, so having a music player would be really nice.

Cheers!

Enigma1309 commented 6 months ago

AFAIK this isn't planned yet, but you can run the ViTune app in Linux via waydroid (if you're on wayland) or Anbox (i think it's depreciated but may work).

Though i wouldn't recommend using either of the above methods, i would suggest you to use Spotube in pc, it's UI is great for desktop usage.. It even has an download feature.. and for offline/local music you can symlink your music folder to ~/Downloads/Spotube

Though i would really love if anyone will work on desktop app, it would be much appreciated <3

Geigerkind commented 6 months ago

I would really love to have a synchronized music library between desktop and mobile app.

I havent looked much at the architecture yet, but I saw a lot of functionality being coupled with the UI code. So this may be a longer stretch to implement another UI.

Just out of curiosity. I am not too familiar with the mobile space. So do you know of any UI library that may be able to support both android and desktop?

25huizengek1 commented 6 months ago

I guess it's theoretically possible to have shared UI for ViTune on multiple platforms, using Kotlin multiplatform and Compose, but since ViTune is written with only Android in mind it would take a lot of refactoring to achieve this, since almost every UI component is using something Android-specific. I guess I could put this issue on low prio for now. I've already been refactoring the codebase here and there, so maybe in the future I can try to implement something.

Enigma1309 commented 6 months ago

I would really love to have a synchronized music library between desktop and mobile app. Could I achieve that with Spotube?

TBH i don't use Spotube in Mobile, i like ViTune , but i think spotube can sync playlist it requires to have a spotify account for that , which beats the purpose of ViTune and it's derivatives.

Geigerkind commented 6 months ago

I tried Spotube, its very very slow. Compared to this vitune is a blessing. Im also short on time, but I will try to contribute to this project. Ill start with some code cleanup in order to get to know the code base. @25huizengek1 have you documented somewhere the target architecture?

Enigma1309 commented 6 months ago

I tried Spotube, its very very slow.

On mobile devices, YES but i don't see a significant issue on Desktop.

I will try to contribute to this project.

Buddy you're just amazing :)

25huizengek1 commented 6 months ago

I tried Spotube, its very very slow. Compared to this vitune is a blessing. Im also short on time, but I will try to contribute to this project. Ill start with some code cleanup in order to get to know the code base. @25huizengek1 have you documented somewhere the target architecture?

Thank you so much for your appreciation. I think it's great that you want to help with this yourself. What do you mean exactly with the target architecture?

Currently, ViTune is just an Android app written in Kotlin with Jetpack Compose, which is Google's recommended way of building UI on Android. Jetbrains (the creator of Kotlin) also created Compose multiplatform, so we could use this in order to share the UI. One of the problems is that currently all of the player logic is written directly for Jetpack Media3 Exoplayer, which is an Android-specific player implementation. Besides, the database uses Room, an Android-specific database (SQLite) library, because that way we are forward-compatible with ViMusic, and while Google is working on making Room multiplatform, we'll have to do a lot of refactoring in order to move to a database that is supported by all our target platforms.

Geigerkind commented 6 months ago

Hey, I have checked out the repo and took a look at the code. As far as I can see there is not much of an intended architecture. Its kind of all over the place.

I would suggest to transform the code base a little bit. What needs to happen is that we decouple a lot of code from its platform specific implementation. I hope I can find some time to propose some general changes. What I plan to do is to establish a hexagonal architecture with manual dependency injection (for now).

I will start to decouple platform specific code like the database by introducing an extra layer of indirection (dependency inversion principle). I will also try to establish a domain. Are you familiar with domain driven design?

This will create a starting point where a desktop implementation could be added on top at. Besides the desktop app there are a few other features that I would like to add for myself (Like having real persistent playlists that can be shared via some form of synchronization). But before that there is a lot of cleaning up to do.

I noticed that a lot of code is currently in the "Services". I want to make it more entity focused.

But before I outline all my plans, Ill just make some proof of concept pull request. Not sure when but I hope I can get to it in the next few weeks.

25huizengek1 commented 6 months ago

@Geigerkind Thank you for your investigation. It's not new to me that the app could use some touching up, and since I don't have much time on my hands either a lot of these problems are still remnants from ViMusic (I want to fix things but I just don't have the time to). The only real stuff I've had the time to fix behind the scenes is stuff like preferences, and some theming code. The data part of ViTune is slowly getting more streamlined, but since it's a lot of work to decouple everything I have decided against refactoring for now because of my limited time frame. It's definitely a needle in the eye if you ask me, since I do have a passion for good software, but working with a medium-sized codebase in my spare time is just something I have to make compromises on.

Dependency injection is not something I'm particulary interested in, but some form of strategy pattern while still maintaining a functional paradigm sounds like a good idea. And while it's great that you want to radically switch gears by suggesting great refactorings, I think the only real problem ViTune has is the fact that there is no (decoupled) single source of truth. I guess we can establish a solution to this problem by modularizing the data fetching, while the data is immutable for the app itself. The only thing that has blocked me from actually proceeding with such a refactoring is the fact that the cache/database is tightly coupled to the Android ecosystem. Almost every call to cache or database requires a Context to be passed.

Also, to clarify, the services you are talking about are not what you call services in MVC, but rather Android platform services, for background tasks/playback.

I guess it's a good idea to establish an alternative for Room first before trying to refactor the entire codebase, especially since we both got limited time to work on this.

Geigerkind commented 6 months ago

Good point!

Lets go with the strategy pattern for now. Ill start to chip away from the gigantic thing thats called "Database" and try to abstract small entity specific repositories. I cant tell yet how those entities are coupled and if some can be merged into aggregates. So this will be a step by step refactoring.

Thanks for clarifying. Im new to android development, but still those services are a little chunky ^^

Expect some tiny merge requests.

25huizengek1 commented 6 months ago

You'll have to understand the fact that a lot of compromises have been made while developing this application. Strictly following an architecture is something that was just unfeasible looking at my personal schedule. I understand that the codebase could use some structuring, and while I try to continue this process, it doesn't go as fast as I want it to most of the time.

Geigerkind commented 6 months ago

Hi @25huizengek1 , this was by no means a critic. I understand that you took over a mess and you are also short on time.

Edit: Im going to work in my fork for now. Lets see how far it goes.

25huizengek1 commented 4 months ago

image

Let's blow some new life into this! We can now safely migrate to KMP, because our database engine just became Multiplatform!