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

Cleanup SponsorBlock video id hashing #4384

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

absidue
Copy link
Member

@absidue absidue commented Nov 25, 2023

Cleanup SponsorBlock video id hashing

Pull Request Type

  • Other - Refactor

Description

Currently the code to create the video ID hash prefix to send to SponsorBlock is rather inefficient, this pull request aims to simplify it, making it more efficient.

Currently it creates an array from the unsigned 8-bit integer array, calls map on it to create a new array with the bytes coverted to hex strings, creates a new array with the first 4 and then joins them to a string, after that it creates a new string with the first 4 characters (this step could have been avoided if only the first two bytes had been chosen in an earlier step, instead of 4).

The new code selects the first two bytes in the unsigned 8-bit integer array and converts those to hex strings and then concatenates them together. This saves a bunch of temporary arrays and strings and also simplifies the code.

Testing

The testing for this pull request is just regression testing.

Turn on SponsorBlock and open a video with SponsorBlock segments, they should still show up in the seek bar and be skipped if you have that configued.

Turn on DeArrow and make sure titles are still being replaced.

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 25, 2023
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 25, 2023 18:28
@FreeTubeBot FreeTubeBot merged commit cb883f2 into FreeTubeApp:development Nov 26, 2023
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 26, 2023
@absidue absidue deleted the sponsor-block-hash branch November 26, 2023 10:33
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 29, 2023
* development: (38 commits)
  Channel subscribe button in search results (FreeTubeApp#4376)
  Translated using Weblate (Czech)
  Translated using Weblate (Portuguese (Brazil))
  Use F5 to refresh subscriptions (FreeTubeApp#4399)
  Miscellaneous improvements to settings page styling (FreeTubeApp#4235)
  Translated using Weblate (Icelandic)
  Translated using Weblate (Swedish)
  Translated using Weblate (Arabic)
  Bump lefthook from 1.5.2 to 1.5.4 (FreeTubeApp#4398)
  Bump electron from 27.1.0 to 27.1.2 (FreeTubeApp#4395)
  Bump electron-builder from 24.6.4 to 24.9.1 (FreeTubeApp#4397)
  Translated using Weblate (Portuguese)
  Translated using Weblate (French)
  Fix bug (FreeTubeApp#4392)
  Translated using Weblate (Spanish)
  Translated using Weblate (Chinese (Traditional))
  Translated using Weblate (Serbian)
  Translated using Weblate (Chinese (Simplified))
  Translated using Weblate (Italian)
  Cleanup SponsorBlock video id hashing (FreeTubeApp#4384)
  ...

# Conflicts:
#	src/renderer/scss-partials/_ft-list-item.scss
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.

5 participants