Skip to content

Conversation

@Nigel1992
Copy link

@Nigel1992 Nigel1992 commented Mar 26, 2025

Add Auto-Like Feature with Channel Filtering and Improved Notifications

Description

This PR introduces a new auto-like feature that automatically likes watched videos. Additionally, it includes a channel filter system that lets users control which channels trigger auto-liking. Improved string handling and notifications enhance the overall user experience.

Changes

New Auto-Like Feature:

  • Added a setting to enable/disable automatic liking of watched videos
  • Implemented proper video liking logic using the correct rate_video method
  • Improved notification messages for clearer feedback

Channel Filtering for Auto-Like:

  • Added support for whitelist and blacklist filtering
  • Implemented case-insensitive channel name matching
  • Corrected channel name extraction from the YouTube API response
  • Configurable filter list via settings

Technical Improvements:

  • Fixed undefined string issues by properly defining all string IDs
  • Added proper error handling for API responses
  • Defined new string IDs for settings and notifications:
    • 30900 → Auto-like settings label and help text
    • 30901 → Auto-like notification message

Files Changed

  • resources/settings.xml (Added settings for auto-like and filtering)
  • resources/language/resource.language.en_gb/strings.po (Defined new language strings)
  • resources/lib/youtube_plugin/kodion/monitors/player_monitor.py (Implemented auto-like logic and improved player monitoring)

Testing

✅ Verified that the auto-like setting appears correctly in the settings menu
✅ Tested auto-like functionality with different channel filters (whitelist & blacklist modes)
✅ Ensured proper notification text display when a video is auto-liked
✅ Confirmed no undefined string IDs are present
✅ Validated language string display across different languages

Additional Notes

This update introduces the auto-like feature for the first time, giving users the ability to automatically like watched videos. The channel filtering system ensures better control over which videos get liked, and improved notifications provide clear and consistent messaging.

Screenshots

📌 [Attach screenshots of settings and notifications if available]

@MoojMidge
Copy link
Collaborator

Thanks for the contribution!

Is this PR the same #1141?

You can either try to separate the commits into the different PRs, or just close one of them and include a common description, as the proposed channel filter does not have any use except for the proposed auto-like functionality.

@Nigel1992 Nigel1992 changed the title feat: Add channel filter system for auto-like functionality feat: Add Auto-Like Feature with Channel Filtering and Improved Notifications Mar 31, 2025
@Nigel1992
Copy link
Author

Hi, thanks for replying!
I must have made a mistake by posting duplicates, sorry.
I've closed the other PR and will keep this PR active.
I've modified the title and description of this PR to match all commits for it.

@MoojMidge
Copy link
Collaborator

I will be adding some helper methods in the next beta to better deal with settings strings that are meant to be used as filters. The intent being to ensure that the parsing of any new filter strings follows the same rules as all the other filter strings without needing to duplicate the same code in multiple places.

While I don't use the rating functionality, I think if you are adding an auto-like feature with a channel filter, then ideally it should be implemented in the following way:

  • Have a channel filter to enable rating after watching
  • Have a second channel filter to enable auto-like after watching
    • Auto like should extend the existing rating mechanism, with like preselected, and with a short timeout. If there is no user interaction, after the timeout the like rating should be submitted.
  • Have a third channel filter to enable auto-dislike after watching
    • Auto dislike should extend the existing rating mechanism, with dislike preselected, and with a short timeout. If there is no user interaction, after the timeout the dilike rating should be submitted.

Not fussed if you are not interested in adding the additional features mentioned above, but there are a few other things that can be improved on a bit:

  • there is duplicate code for managing remote and local watch history that is already done elsewhere in the player monitor
  • filter processing is not really optimised as it loops through the filter twice and does a separate membership test (can be resolved by using helper methods that will be available in next beta version)
  • the API request for the channel name is not necessarily needed because the channelID is already known (can be resolved by using helper methods that will be available in next beta version)
  • new code doesn't check if the user is logged in until after the processing is already done
  • new code moves rating related code out of the yt_video module and into the player monitor, and also in a different place in the player monitor, rather than keeping it together with the existing rating related code

Once the next beta is available, and the new helper methods can be used, I will provide more specific review comments.

@Nigel1992
Copy link
Author

Nigel1992 commented Apr 8, 2025

@MoojMidge Thanks for your detailed reply and suggestions.
One thing that confused me is the auto-dislike.
Why would someone watch a video he knows beforehand that he wont like to watch?

Also, I think ever since I added this feature, the watched markers are not working anymore ?
Perhaps you can tell me what might have caused that and a possible fix ?

@MoojMidge
Copy link
Collaborator

One thing that confused me is the auto-dislike.
Why would someone watch a video he knows beforehand that he wont like to watch?

That is a good point. As I mentioned, I don't make use of the rating functionality so if you think it doesn't make sense or have any use, then feel free to ignore the feature suggestions.

What I did have in mind though was that because the filters used elsewhere in the addon do more than just match on the channel name, and also allow you to match on any available metadata for a video, you could potentially add a filter to dislike a video that you started watching, but then stopped watching shortly after, based on a filter for played percentage or played time.

Also, I think ever since I added this feature, the watched markers are not working anymore ?
Perhaps you can tell me what might have caused that and a possible fix ?

I think it is because of this:

there is duplicate code for managing remote and local watch history that is already done elsewhere in the player monitor

Try removing these additions and see how you go:
https://github.com/anxdpanic/plugin.video.youtube/pull/1142/files#diff-b0d7838c93cb604f75dd38f49e5ae0cd231cb1763675c19f5e85f3ebaf99f383R201-R217

@Nigel1992
Copy link
Author

Nigel1992 commented Apr 10, 2025

What I did have in mind though was that because the filters used elsewhere in the addon do more than just match on the channel name, and also allow you to match on any available metadata for a video, you could potentially add a filter to dislike a video that you started watching, but then stopped watching shortly after, based on a filter for played percentage or played time.

What if the user clicked on the wrong video and closes it shortly after or opened the wrong add-on etc ?
This will falsely flag it as disliked.

Try removing these additions and see how you go:
https://github.com/anxdpanic/plugin.video.youtube/pull/1142/files#diff-b0d7838c93cb604f75dd38f49e5ae0cd231cb1763675c19f5e85f3ebaf99f383R201-R217

I've removed it just now. :)

Also...
I’ve broken down the tasks you mentioned earlier into a to-do list.
Could you please review it and confirm if everything looks correct?
If there are any adjustments or additional items, feel free to let me know!

Pending Implementation (After Next Beta Release)

  • Refactor filter string parsing using the new helper methods from the upcoming beta to avoid code duplication and ensure consistency.

Auto-Rating Feature Enhancements

  • Add channel filter to enable rating after watching.
  • Add channel filter to enable auto-like after watching:
    • Extend the existing rating mechanism.
    • Preselect like.
    • Add a short timeout.
    • If no user interaction, submit like automatically after timeout.
  • Add channel filter to enable auto-dislike after watching:
    • Extend the existing rating mechanism.
    • Preselect dislike.
    • Add a short timeout.
    • If no user interaction, submit dislike automatically after timeout.

Code Clean-Up and Optimization

  • Remove duplicate code related to managing remote/local watch history by reusing what already exists in player_monitor.
  • Optimize filter processing:
    • Avoid looping through the filter twice.
    • Avoid separate membership tests (use the upcoming helper methods).
  • Avoid unnecessary API request for channel name:
    • Use channel ID instead (with help from new helper methods).
  • Ensure the code checks user login status earlier, before processing logic.
  • Move any new rating-related code back into the yt_video module or keep it together with the existing rating logic in the same place in player_monitor.

File to Review:

plugin.video.youtube/resources/lib/youtube_plugin/kodion/monitors/player_monitor.py

Line 261 in commit a201f5b:
# rate video

Thanks in advance! Looking forward to hearing your thoughts.

@MoojMidge
Copy link
Collaborator

What if the user clicked on the wrong video and closes it shortly after or opened the wrong add-on etc ?
This will falsely flag it as disliked.

That was why I suggested showing the existing rating dialog with a short timeout rather than just liking or disliking directly, so the user has an oportunity to dismiss the rating. But as I said if you don't think it is practical/useful then I won't insist on this being required.

Everything else seems clear, but I am still working out some issues with the helper methods for channel matching #1159. There are issues with correctly identifying a channel based on four possible sources of identification:

  • channel name - this is the way it is currently done, but the channel name can be duplicated across many different channels which means the filters can incorrectly match multiple channels
  • channelId or channel owners username - difficult to determine for a user and potentially difficult to copy/enter into the channel filter.
  • channel handle - seems to be unique but not all channels have them and requires updating existing channel filters. This will be the most likely method used for channel filtering moving forward.

@MoojMidge
Copy link
Collaborator

Sorry for the lack of action on this. An update:

  • the issues with the new helper methods have now all been resolved.
  • once the current alpha versions are merged into master and a beta version is available will be able to get this in as well

@MoojMidge MoojMidge force-pushed the feature/auto-like-filter branch from e71cbed to f6ed59b Compare December 14, 2025 23:56
@MoojMidge
Copy link
Collaborator

Have rebased and updated this PR to utilise some of the existing helper methods used for filtering/matching.

Can you test and verify that it still works in the way you intended?

Nigel1992 and others added 4 commits December 17, 2025 08:04
…nnel name filtering, fix channel name extraction, update rate_video method, add language strings and filter settings
- Use setting constants and dedicated setting methods
- Use existing helper method to parse filter string
- Use existing helper method match against filter string and cache API lookups
- Use existing methods to rate video
- Only auto-like if video has been marked as watched
- Avoid conflict between auto-like and existing rate after watching functionality
- Reduce number of added settings
- Reuse existing translatable strings where possible
@MoojMidge MoojMidge force-pushed the feature/auto-like-filter branch from f6ed59b to c1f17a9 Compare December 16, 2025 21:06
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