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

updater.ps1: yt-dlp update to stable, nightly, master #2

Closed
wants to merge 0 commits into from
Closed

updater.ps1: yt-dlp update to stable, nightly, master #2

wants to merge 0 commits into from

Conversation

Obegg
Copy link

@Obegg Obegg commented Jun 25, 2024

Now updater.ps1 has the option to change update channels for yt-dlp:

  1. Stable (default) - https://github.com/yt-dlp/yt-dlp/releases
  2. Nightly - https://github.com/yt-dlp/yt-dlp-nightly-builds/releases
  3. Master - https://github.com/yt-dlp/yt-dlp-master-builds/releases

For those unfamiliar with update channels - https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#update

Adds <ytdlpupdatechannel> value to settings.xml file.
Users who don't have this value in settings.xml file - it will be added automatically without user interaction (same solution as previous PR)

A prompt will ask the user which update channel he would like to use, but only if yt-dlp is installed.

Solves shinchiro#41
Solves other issue where a user wanted a feature that will change update channels (can't find it).

@Obegg
Copy link
Author

Obegg commented Jun 26, 2024

@zhongfly Can you please review this PR?
I consider using vscode-powershell extension to reformat the code later after this PR is merged.

@zhongfly
Copy link
Owner

zhongfly commented Jun 26, 2024

I consider using vscode-powershell extension to reformat the code later after this PR is merged.

NO,this will make me difficult to merge commits from shinchiro/mpv-packaging.

@Obegg
Copy link
Author

Obegg commented Jun 27, 2024

NO,this will make me difficult to merge commits from shinchiro/mpv-packaging.

While I can understand that and to some degree I can agree with that - I noticed that shinchiro/mpv-packaging rarely gets any commits (even though there are PRs).
Are we sure we want to be "held back" by this? Because if not and we make "big" changes to this repo (like formatting it properly using a powershell extenstion via vscode) it should still be fairly easy to merge commits from the shinchiro/mpv-packaging since commits from his repo would probably be once a year and a short change/addition (considering the only changed file is updater.ps1).

Have you found any issues with this PR? I have tested it, haven't found any issues.

I was even considering adding update channels for youtube-dl but I see that there is only one viable option which is the nightly builds and not the original (since it's outdated), but I gave up because I was thinking about retiring youtube-dl from updater.ps1 since yt-dlp merges commits from youtube-dl, so basically yt-dlp is the better option here (unless I missed something here, in that case - feel free to correct me).

@zhongfly
Copy link
Owner

zhongfly commented Jun 27, 2024

if ($ytdl -eq 'ytdlp') {
$latest_release = Get-Latest-Ytplugin "yt-dlp"
Download-Ytplugin "yt-dlp" $latest_release
}

People who have never downloaded yt-dlp before will encounter errors by selecting options other than Stable. This is because Get-Latest-Ytplugin will give a version that doesn't exist in https://github.com/yt-dlp/yt-dlp/releases, while Download-Ytplugin will only download from https://github.com/yt-dlp/yt -dlp/releases(stable)

@zhongfly zhongfly marked this pull request as draft June 27, 2024 11:40
@Obegg
Copy link
Author

Obegg commented Jun 27, 2024

People who have never downloaded yt-dlp before will encounter errors by selecting options other than Stable.

Nice catch, thank you.

I think this can be solved by using:

if (((Test-Path 'yt-dlp.exe') -eq $false) -and ($ytdlp_channel -eq 'nightly')) {
    Invoke-WebRequest -Uri (((Invoke-RestMethod -Method GET -Uri 'https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest').assets | Where-Object name -Like 'yt-dlp.exe' ).browser_download_url) -OutFile 'yt-dlp.exe'
}
if (((Test-Path 'yt-dlp.exe') -eq $false) -and ($ytdlp_channel -eq 'master')) {
    Invoke-WebRequest -Uri (((Invoke-RestMethod -Method GET -Uri 'https://api.github.com/repos/yt-dlp/yt-dlp-master-builds/releases/latest').assets | Where-Object name -Like 'yt-dlp.exe' ).browser_download_url) -OutFile 'yt-dlp.exe'
}

I'm just not sure where to put this in...

@Obegg
Copy link
Author

Obegg commented Jun 27, 2024

Fixed the issue you mentioned.
now because I'm still new to Git I don't know how to squash commits, care to explain to me?

@Obegg Obegg closed this Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants