Package for Flatpak #2047

Open
Grafcube wants to merge 2 commits from Grafcube/flatpak-package into master
Grafcube commented 2024-05-11 08:05:24 +00:00 (Migrated from github.com)

Closes #737

This patch adds flatpak support. I built and installed it on my branch with these commands:

pnpm build
pnpm electron-builder --linux flatpak
flatpak install --bundle 'pack/YouTube Music-3.3.6-x86_64.flatpak'

A few things to note, I need to write a separate yml to publish to flathub which repeats a lot of metadata (electron builder doesn't currently have any way to publish to flathub automatically). According to the flatpak app submission guidelines:

Flathub is primarily intended as a service that is used by app developers to distribute their apps. Our goal is to give developers control of their apps and to allow them a closer relationship with their users without middlemen getting in the way. However, as part of setting up Flathub, some applications are being distributed on Flathub without the involvement of their developers. We would prefer that these applications are controlled by their authors.

I am perfectly fine with maintaining the flatpak myself.

The appstream metadata should probably contain content warnings since YT music also has explicit content. I've left it blank for now. It also needs to be packaged manually since electron builder doesn't yet support adding it (see electron-userland/electron-builder#1993). I'll manually include it in the manifest until that issue is resolved. The appstream file is useful for all linux packages, not just flatpak, which is why I've included it in the PR.

If you don't want to wait, you can checkout my branch and install it yourself with the above commands. Cheers!

Closes #737 This patch adds flatpak support. I built and installed it on my branch with these commands: ```sh pnpm build pnpm electron-builder --linux flatpak flatpak install --bundle 'pack/YouTube Music-3.3.6-x86_64.flatpak' ``` A few things to note, I need to write a separate yml to publish to flathub which repeats a lot of metadata (electron builder doesn't currently have any way to publish to flathub automatically). According to the flatpak [app submission guidelines](https://github.com/flathub/flathub/wiki/App-Submission#someone-else-has-put-my-app-on-flathubwhat-do-i-do): > Flathub is primarily intended as a service that is used by app developers to distribute their apps. Our goal is to give developers control of their apps and to allow them a closer relationship with their users without middlemen getting in the way. However, as part of setting up Flathub, some applications are being distributed on Flathub without the involvement of their developers. We would prefer that these applications are controlled by their authors. I am perfectly fine with maintaining the flatpak myself. The appstream metadata should probably contain content warnings since YT music also has explicit content. I've left it blank for now. It also needs to be packaged manually since electron builder doesn't yet support adding it (see electron-userland/electron-builder#1993). I'll manually include it in the manifest until that issue is resolved. The appstream file is useful for all linux packages, not just flatpak, which is why I've included it in the PR. If you don't want to wait, you can checkout my branch and install it yourself with the above commands. Cheers!
th-ch (Migrated from github.com) reviewed 2024-05-11 08:05:24 +00:00
razzeee commented 2024-05-11 10:19:25 +00:00 (Migrated from github.com)

You can try using https://hughsie.github.io/oars/generate.html to generate the missing oars data

You can try using https://hughsie.github.io/oars/generate.html to generate the missing oars data
Grafcube commented 2024-05-11 10:38:21 +00:00 (Migrated from github.com)

You can try using https://hughsie.github.io/oars/generate.html to generate the missing oars data

Here's what I got. I'm unsure if it's accurate since it's only audio and not video.

  <content_rating type="oars-1.1">
    <content_attribute id="drugs-alcohol">mild</content_attribute>
    <content_attribute id="drugs-narcotics">mild</content_attribute>
    <content_attribute id="drugs-tobacco">mild</content_attribute>
    <content_attribute id="sex-nudity">mild</content_attribute>
    <content_attribute id="sex-themes">mild</content_attribute>
    <content_attribute id="language-profanity">moderate</content_attribute>
    <content_attribute id="social-info">intense</content_attribute>
    <content_attribute id="money-purchasing">intense</content_attribute>
    <content_attribute id="money-advertising">intense</content_attribute>
  </content_rating>
> You can try using https://hughsie.github.io/oars/generate.html to generate the missing oars data Here's what I got. I'm unsure if it's accurate since it's only audio and not video. ```xml <content_rating type="oars-1.1"> <content_attribute id="drugs-alcohol">mild</content_attribute> <content_attribute id="drugs-narcotics">mild</content_attribute> <content_attribute id="drugs-tobacco">mild</content_attribute> <content_attribute id="sex-nudity">mild</content_attribute> <content_attribute id="sex-themes">mild</content_attribute> <content_attribute id="language-profanity">moderate</content_attribute> <content_attribute id="social-info">intense</content_attribute> <content_attribute id="money-purchasing">intense</content_attribute> <content_attribute id="money-advertising">intense</content_attribute> </content_rating> ```
Owner

is there any point in setting oars ratings to anything other than intense?
we do not have control over youtube's content, so we cannot explicitly set age ratings

is there any point in setting oars ratings to anything other than `intense`? we do not have control over youtube's content, so we cannot explicitly set age ratings
razzeee commented 2024-05-12 09:09:40 +00:00 (Migrated from github.com)

Won't this also play video in some cases?

Won't this also play video in some cases?
MulverineX commented 2024-05-16 08:05:09 +00:00 (Migrated from github.com)

Also social-info shouldn't be marked intense, anonymous users can use this app

Also `social-info` shouldn't be marked intense, anonymous users can use this app
Grafcube commented 2024-05-18 11:48:03 +00:00 (Migrated from github.com)

Also social-info shouldn't be marked intense, anonymous users can use this app

I'm pretty sure the algorithm still works for anonymous users.

From https://hughsie.github.io/oars/generate.html
If the user is able to "enable" NSFW or "adult" content, then this should be included in the assessment even if it is turned off by default.

This makes me think that it should be the "worst case" for all the fields.

> Also `social-info` shouldn't be marked intense, anonymous users can use this app I'm pretty sure the algorithm still works for anonymous users. > From https://hughsie.github.io/oars/generate.html > If the user is able to "enable" NSFW or "adult" content, then this should be included in the assessment even if it is turned off by default. This makes me think that it should be the "worst case" for all the fields.
JellyBrick (Migrated from github.com) reviewed 2024-05-31 17:39:26 +00:00
@ -0,0 +21,4 @@
https://github.com/th-ch/youtube-music/assets/16558115/53efdf73-b8fa-4d7b-a235-b96b91ea77fc</image>
</screenshot>
</screenshots>
<releases>
JellyBrick (Migrated from github.com) commented 2024-05-31 17:39:04 +00:00

Do we need to write this XML manually for each release?

Do we need to write this XML manually for each release?
razzeee (Migrated from github.com) reviewed 2024-05-31 18:33:04 +00:00
@ -0,0 +21,4 @@
https://github.com/th-ch/youtube-music/assets/16558115/53efdf73-b8fa-4d7b-a235-b96b91ea77fc</image>
</screenshot>
</screenshots>
<releases>
razzeee (Migrated from github.com) commented 2024-05-31 18:33:04 +00:00

If you have a sane way of feeding a tool, writing a script that modifies xml is pretty straightforward. Problem usually is the changelog, version number etc.

If you have a sane way of feeding a tool, writing a script that modifies xml is pretty straightforward. Problem usually is the changelog, version number etc.
Grafcube (Migrated from github.com) reviewed 2024-06-01 02:08:45 +00:00
@ -0,0 +21,4 @@
https://github.com/th-ch/youtube-music/assets/16558115/53efdf73-b8fa-4d7b-a235-b96b91ea77fc</image>
</screenshot>
</screenshots>
<releases>
Grafcube (Migrated from github.com) commented 2024-06-01 02:08:45 +00:00

I used this tool to automatically fetch and populate the release history.

https://jakobdev.codeberg.page/work/app/jdAppStreamEdit/

I didn't have to do anything manually so I think it should be easy enough to make a script to automatically update the file.

I used this tool to automatically fetch and populate the release history. https://jakobdev.codeberg.page/work/app/jdAppStreamEdit/ I didn't have to do anything manually so I think it should be easy enough to make a script to automatically update the file.
Skythrew commented 2024-06-18 08:02:07 +00:00 (Migrated from github.com)

Any update on this ? :) Would be really cool to see the app packaged as a Flatpak 👍

Any update on this ? :) Would be really cool to see the app packaged as a Flatpak :+1:
Grafcube commented 2024-06-19 11:55:33 +00:00 (Migrated from github.com)

The app currently uses com.github.th_ch.youtube_music as its app id but according to this, it makes more sense to use io.github.th_ch.youtube_music. This is probably better suited for a separate issue but maybe all instances of the old app id should be changed?

https://docs.flathub.org/docs/for-app-authors/verification/#source-code-hosting-site

Apart from that, I'll try to make a manifest that can be used for submission into flathub whenever I get the time.

The app currently uses `com.github.th_ch.youtube_music` as its app id but according to this, it makes more sense to use `io.github.th_ch.youtube_music`. This is probably better suited for a separate issue but maybe all instances of the old app id should be changed? <https://docs.flathub.org/docs/for-app-authors/verification/#source-code-hosting-site> Apart from that, I'll try to make a manifest that can be used for submission into flathub whenever I get the time.
Grafcube commented 2024-09-02 07:43:54 +00:00 (Migrated from github.com)

Despite my best attempts it's been really complicated to build a flatpak. I think I'm going to give up and just manually update it when I need to. I'm going to leave some information here if anyone else wants to take a crack at it.

  • Generate a list of sources from pnpm-lock.yaml to include in the flatpak manifest sources.
  • electron-builder only generates a single-file bundle. I couldn't figure out a way to get it to build a directory.
  • Trying to package a regular linux build is more complicated because electron builder doesn't generate a desktop file for other package types (unless I just don't know how to do it).

Here's the changes I made to package.json to build a flatpak with the commands in my original comment.

"linux": {
  "icon": "assets/generated/icons/png",
  "category": "AudioVideo",
  "target": [
    "AppImage",
    "snap",
    "freebsd",
    "flatpak",
    "deb",
    "rpm"
  ]
},
"flatpak": {
  "runtimeVersion": "23.08",
  "baseVersion": "23.08",
  "useWaylandFlags": true,
  "finishArgs": [
    "--socket=wayland",
    "--socket=fallback-x11",
    "--share=ipc",
    "--device=dri",
    "--socket=pulseaudio",
    "--filesystem=xdg-music",
    "--share=network",
    "--talk-name=org.freedesktop.Notifications",
    "--talk-name=org.kde.StatusNotifierWatcher",
    "--talk-name=org.gnome.SettingsDaemon.MediaKeys",
    "--talk-name=com.canonical.AppMenu.Registrar",
    "--talk-name=org.gnome.SessionManager",
    "--own-name=org.mpris.MediaPlayer2.chromium.*"
  ]
},
Despite my best attempts it's been really complicated to build a flatpak. I think I'm going to give up and just manually update it when I need to. I'm going to leave some information here if anyone else wants to take a crack at it. - [ ] Generate a list of sources from `pnpm-lock.yaml` to include in the flatpak manifest sources. - [ ] electron-builder only generates a single-file bundle. I couldn't figure out a way to get it to build a directory. - [ ] Trying to package a regular linux build is more complicated because electron builder doesn't generate a desktop file for other package types (unless I just don't know how to do it). Here's the changes I made to `package.json` to build a flatpak with the commands in my original comment. ```json "linux": { "icon": "assets/generated/icons/png", "category": "AudioVideo", "target": [ "AppImage", "snap", "freebsd", "flatpak", "deb", "rpm" ] }, "flatpak": { "runtimeVersion": "23.08", "baseVersion": "23.08", "useWaylandFlags": true, "finishArgs": [ "--socket=wayland", "--socket=fallback-x11", "--share=ipc", "--device=dri", "--socket=pulseaudio", "--filesystem=xdg-music", "--share=network", "--talk-name=org.freedesktop.Notifications", "--talk-name=org.kde.StatusNotifierWatcher", "--talk-name=org.gnome.SettingsDaemon.MediaKeys", "--talk-name=com.canonical.AppMenu.Registrar", "--talk-name=org.gnome.SessionManager", "--own-name=org.mpris.MediaPlayer2.chromium.*" ] }, ```
JellyBrick commented 2024-10-15 04:36:34 +00:00 (Migrated from github.com)

Added flatpak bundle starting in 3.6.1 and later
https://github.com/th-ch/youtube-music/releases/tag/v3.6.1

Added flatpak bundle starting in 3.6.1 and later https://github.com/th-ch/youtube-music/releases/tag/v3.6.1
thalskarth commented 2024-12-04 18:44:35 +00:00 (Migrated from github.com)

Any plans on publishing the flatpak in the flathub repo?

Any plans on publishing the flatpak in the flathub repo?
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin Grafcube/flatpak-package:Grafcube/flatpak-package
git switch Grafcube/flatpak-package

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff Grafcube/flatpak-package
git switch Grafcube/flatpak-package
git rebase master
git switch master
git merge --ff-only Grafcube/flatpak-package
git switch Grafcube/flatpak-package
git rebase master
git switch master
git merge --no-ff Grafcube/flatpak-package
git switch master
git merge --squash Grafcube/flatpak-package
git switch master
git merge --ff-only Grafcube/flatpak-package
git switch master
git merge Grafcube/flatpak-package
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: YTMD/youtube-music#2047
No description provided.