Newpipe: Swipe to dismiss notification (deleteIntent)

Created on 27 Sep 2020  路  10Comments  路  Source: TeamNewPipe/NewPipe

Reminder for @Stypox.

Apps like VLC allow the user to swipe the notification away to dismiss it when playback is paused. Users have expected and asked for this feature in the Notification PR thread: https://github.com/TeamNewPipe/NewPipe/pull/3178#issuecomment-689186627, https://github.com/TeamNewPipe/NewPipe/pull/3178#issuecomment-689271503, https://github.com/TeamNewPipe/NewPipe/pull/3178#issuecomment-689294566.

Prerequisite: This feature requires Newpipe to have the ability to save the play queue to disk, so that if Android kills the notification, the app can resume from where it left off instead of clearing the queue.

GUI enhancement notification player

Most helpful comment

@opusforlife2 yes I am willing to work on this and would eventually try to submit a PR.

All 10 comments

Can I work on this issue?

This feature needs some groundwork first, as written in the OP. Are you wanting to work on that or deleteIntent itself?

I would like to give it a try , can easily do the deleteIntent part though but need to work on the prerequisite one.

@starboi02 in order to implement queue saving, you have to save it to the database. Theoretically you could just add a boolean column to the streams table representing whether the stream is saved or not, but this approach is not future-proof, since sooner or later we may want to allow the user to save multiple play queues, if he wants to. Hence, I would build the system in such a way that we can expand it in the future, thus allowing to store multiple queues. This is what I'd do:

  • Create a queues table, keeping in mind that queues could have continuations, represented using the Page class and the AbstractInfoPlayQueue class (e.g. when you play a playlist, it is not downloaded as a whole at once, but it is instead downloaded piece by piece on request). So these would be the columns :

    • primary_key: the autoincrement integer uniquely representing the queue

    • queue_index: nonnull integer representing the queue integer

    • service_id: nullable integer: if present, indicates this queue is an AbstractInfoPlayQueue; represents the continuations service id for AbstractInfoPlayQueue

    • base_url: nullable string: AbstractInfoPlayQueue's baseUrl

    • next_page_url: nullable string: AbstractInfoPlayQueue.nextPage's url

    • next_page_id: nullable string: AbstractInfoPlayQueue.nextPage's id

    • (AbstractInfoPlayQueue.nextPage's ids, is not here because it requires a 1 to N relationship, see below)

    • page_cookies: nullable string representing comma-separated cookies from AbstractInfoPlayQueue.nextPage's cookies (like in the browser)

  • Create a queue_page_ids table, representing a 1 to N relationship to the queues table with AbstractInfoPlayQueue.nextPage's ids, made of two columns:

    • queue_pk: nonnull integer: the queue primary key this id belongs to

    • page_id: nonnull string: the id from the page

  • Create a queue_items table, representing a N to N relationship between the streams table and the queues one. Therefore it should have two integer columns:

    • stream_pk: nonnull integer: the stream primary key

    • queue_pk: nonnull integer: the queue primary key

  • Change StreamDAO.deleteOrphans() so that it makes sure the stream is not used inside queue_items before deleting it from the database.

With such an infrastructure in place you should be able to save the playqueue on player shutdown (but not when the user manually closes the player) and restore it when the user taps play again in the notification. If you have any question feel free to ask ;-)

:O

@starboi02 Do you wish to tackle this? If so, I'll assign you this issue. If not, please respond so someone else is free to work on this.

@opusforlife2 I tried making things work but its not going the way i expected, you can assign anyone who's willing to work on this.

but its not going the way i expected

It's fine if it takes you time to figure things out, you know. I just need to know if you're willing to work on it and submit a PR eventually.

@opusforlife2 yes I am willing to work on this and would eventually try to submit a PR.

Awesome! Thank you for taking this on. :)

(I _really_ want this feature :P )

Was this page helpful?
0 / 5 - 0 ratings