Edit video privacy settings in batch

Hi,

I want to change the privacy setting for all the videos in a channel. Is it possible?

Hello,

It’s not possible to perform bulk actions to update user videos yet, but this is planned for the next Peertube version.

1 Like

For now, one has to sneak directly in pq database (su <peertube_user>, then psql <peertube_db_name>). That is not advised unless you are sure and made a database backup before, and have some skills in SQL language.

select distinct privacy from video where "channelId" in (select id from "videoChannel" where "accountId" in (select id from account where name = '<account_username>'));

→ privacy value seems to be 1:public, 4:internal, etc
→ then write your SQL update accordingly.

Hello,

Thank you very much for your help. Is this correct to change all the videos for user=’ada’ to internal?

UPDATE video
SET privacy = 4
FROM (
select distinct privacy from video where « channelId » in (select id from « videoChannel » where « accountId » in (select id from account where name = ‘ada‘))
) AS subquery

update “video“ set privacy = 4 where "channelId" in (select id from "videoChannel" where "accountId" in (select id from account where name = ‘ada‘));

I may not finish this query with “AS subquery“ but “;”. User name ‘ada‘ is minor case, that may not work if registered name is ‘Ada‘.

Make sure you have a recent backup of your database, just in case.

Thank you very much.