Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEPRECATED] Local Subscriptions Plugin #340

Closed
wants to merge 730 commits into from
Closed

[DEPRECATED] Local Subscriptions Plugin #340

wants to merge 730 commits into from

Conversation

fdr-smnv
Copy link

As the title says this plugin allows the user to save subscriptions locally without google account. It adds 'Subscriptions' tab in the menu which opens new window with the list of user's local subscriptions that can be opened in the main window. I think this plugin would go hand in hand with no-google-login plugin. Also I'm fairly new to electron so I'm pushing this plugin early to hopefully get some feedback and advice.

What works:

  • Subscribing to music channels with subscribe button
  • Saving subscription in plugin options
  • New menu tab button
  • Tab button opens window with subscriptions list
  • Subscription list item on click redirects main window to channel url

Issues/TODO:

  • Couldn't manage to call functions from prerender without contextBridge
  • Initial load doesn't render sub button
  • loadURL makes full page rerender. If possible it would be great if user could click channel in the list and get redirected without slow full page refresh
  • No styles for subs list & buttons
  • (Probably issue) Saving subscription data in plugin options
  • Ability to sort and filter saved channels
  • Export subscription data?

th-ch and others added 20 commits June 24, 2021 21:49
…3c3c69b869a

[Snyk] Upgrade custom-electron-titlebar from 3.2.6 to 3.2.7
…a5d8110bde3

[Snyk] Upgrade @ffmpeg/ffmpeg from 0.9.8 to 0.10.0
…rade-a785f5d95c7765e2d47737e150a2263d

# By Araxeus (2) and snyk-bot (2)
# Via GitHub (3) and Araxeus (1)
* 'master' of github.com:th-ch/youtube-music:
  check if native image is empty before writing id tag
  fix unsupported hidden webp coverart
  fix: upgrade @ffmpeg/ffmpeg from 0.9.8 to 0.10.0
  fix: upgrade custom-electron-titlebar from 3.2.6 to 3.2.7
…7e150a2263d

[Snyk] Upgrade @ffmpeg/core from 0.9.0 to 0.10.0
…nes-3.0.1

Bump trim-newlines from 3.0.0 to 3.0.1
…url-4.5.1

Bump normalize-url from 4.5.0 to 4.5.1
…00ed1b78d70

[Snyk] Upgrade electron-updater from 4.3.8 to 4.3.9
…5e4912a4659

[Snyk] Upgrade ytdl-core from 4.8.0 to 4.8.2
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.20...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…7.21

Bump lodash from 4.17.20 to 4.17.21
…-info-2.8.9

Bump hosted-git-info from 2.8.8 to 2.8.9
Copy link
Owner

@th-ch th-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising, the plugin is a good idea ! It seems the PR now includes a bunch of unrelated commits so probably worth rebasing - I left a comment about having a store migration to ensure the config is there, with that this version could ship - from there, plenty of potential! (linking to the channel pages, saving videos or any playlist, etc)

@@ -76,6 +76,10 @@ const defaultConfig = {
"music_offtopic",
],
},
"local-subscriptions": {
enabled: false,
subscriptions: {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will require a store migration: when you enable it for the first time, your config will end up with:

local-subscriptions": {
  enabled: true
}

And the code does not support empty subscriptions :)

break;
case ACTIONS.SUBS_LI_CLK:
subscriptionsWindow.close();
console.log(action)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: only log that in dev mode (if is.dev())

@Araxeus
Copy link
Collaborator

Araxeus commented Oct 24, 2021


loadURL makes full page rerender. If possible it would be great if user could click channel in the list and get redirected without slow full page refresh

  • You can use the method that I found to navigate to youtube-music pages without reloading:
const browseId = 'UCO8fwuNOHp3wujDbfRJATzQ'
$('ytmusic-app').navigate_(browseId)

  • I think this would greatly benefit of using the new custom prompt (Custom Prompt for changing options #243) for the popup
    • will probably needs a new kind of prompt (List) which should be easy to implement there
    • Still needs some more styling of sub button

  • Why listen for the css injection finish event? I think it shouldn't matter - you could immediately add the local subscriptions button to the menu

win.webContents.send("subscriptions-css-ready");

ipcRenderer.on('subscriptions-css-ready', () => {


This plugin could also allow "subscribing" to playlist which would resolve #363
/Albums/Artists/?Songs?
to get browseId from page use

const browseId=
$('ytmusic-app').__data.mainContentData_.endpoint.data.browseId

(current page is an album if browseId starts with MPLAUC, artist if it starts with UC)
can also be checked using

const pageType =
$('ytmusic-app').__data.mainContentData_.endpoint.data
  .browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType;

const expectedResults = [
  'MUSIC_PAGE_TYPE_ARTIST',
  'MUSIC_PAGE_TYPE_ALBUM',
  'MUSIC_PAGE_TYPE_PLAYLIST'
]

(btw this whole thing is more "bookmarks" than "subscriptions" but the latter sounds better so whatever 😅


Optionally if we want to capture an icon for the page (Channel/Artist/Playlist/Album) this could work:

function getPageThumbnail() {
    const header = $('ytmusic-app').__data.mainContentData_.response.header;
    const headerRenderer = header.musicImmersiveHeaderRenderer || header.musicDetailHeaderRenderer || header.musicVisualHeaderRenderer;
    const thumbnailType = headerRenderer.foregroundThumbnail || headerRenderer.thumbnail;
    const thumbnailRenderer = thumbnailType.musicThumbnailRenderer || thumbnailType.croppedSquareThumbnailRenderer;
    const thumbnails = thumbnailRenderer.thumbnail.thumbnails;
    
    if (!thumbnails || thumbnails.length <= 0) return '';
    return thumbnails[thumbnails.length - 1].url.replace(/=.*/, '=w100-h100-p-l90-rj');
}

Maybe add an option to disable the normal library button


@fdr-smnv contact me on discord(Araxeus#0819) or here if u wanna do some changes because I'm also trying some stuff out

@JellyBrick JellyBrick added enhancement New feature or request need rebase This plugin need rebase labels Oct 7, 2023
@JellyBrick JellyBrick changed the title Local Subscriptions Plugin [DEPRECATED] Local Subscriptions Plugin Dec 27, 2023
@fdr-smnv fdr-smnv closed this by deleting the head repository Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request need rebase This plugin need rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants