1
0
Fork 0

Ensure local actors preferredName don't already exist

Before applying this commit, check you don't have duplicates local
actors in your database:

select "preferredUsername" from actor where "serverId" is null group by "preferredUsername" having count(*) > 0

If you have some results, it seems you have duplicate channels/accounts.
For every entry, you'll have to change the preferredUsername of the
entry you want (so they are unique). The updated actors could have some
federations issues. Sorry.
This commit is contained in:
Chocobozzz 2019-12-05 14:57:14 +01:00
parent 7b7d4e2a6a
commit 77e0851758
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 25 additions and 12 deletions

View File

@ -48,6 +48,7 @@ import {
MActorWithInboxes
} from '../../typings/models'
import * as Bluebird from 'bluebird'
import { Op } from 'sequelize'
enum ScopeNames {
FULL = 'FULL'
@ -115,7 +116,19 @@ export const unusedActorAttributesForAPI = [
},
{
fields: [ 'preferredUsername', 'serverId' ],
unique: true
unique: true,
where: {
serverId: {
[Op.ne]: null
}
}
},
{
fields: [ 'preferredUsername' ],
unique: true,
where: {
serverId: null
}
},
{
fields: [ 'inboxUrl', 'sharedInboxUrl' ]

View File

@ -15,7 +15,7 @@ export enum VideoResolution {
*
* Sources for individual quality levels:
* Google Live Encoder: https://support.google.com/youtube/answer/2853702?hl=en
* YouTube Video Info (tested with random music video): https://www.h3xed.com/blogmedia/youtube-info.php
* YouTube Video Info: youtube-dl --list-formats, with sample videos
*/
function getBaseBitrate (resolution: VideoResolution) {
switch (resolution) {
@ -25,28 +25,28 @@ function getBaseBitrate (resolution: VideoResolution) {
case VideoResolution.H_240P:
// quality according to Google Live Encoder: 300 - 700 Kbps
// Quality according to YouTube Video Info: 186 Kbps
return 250 * 1000
// Quality according to YouTube Video Info: 285 Kbps
return 320 * 1000
case VideoResolution.H_360P:
// quality according to Google Live Encoder: 400 - 1,000 Kbps
// Quality according to YouTube Video Info: 480 Kbps
return 500 * 1000
// Quality according to YouTube Video Info: 700 Kbps
return 780 * 1000
case VideoResolution.H_480P:
// quality according to Google Live Encoder: 500 - 2,000 Kbps
// Quality according to YouTube Video Info: 879 Kbps
return 900 * 1000
// Quality according to YouTube Video Info: 1300 Kbps
return 1500 * 1000
case VideoResolution.H_720P:
// quality according to Google Live Encoder: 1,500 - 4,000 Kbps
// Quality according to YouTube Video Info: 1752 Kbps
return 1750 * 1000
// Quality according to YouTube Video Info: 2680 Kbps
return 2800 * 1000
case VideoResolution.H_1080P:
// quality according to Google Live Encoder: 3000 - 6000 Kbps
// Quality according to YouTube Video Info: 3277 Kbps
return 3300 * 1000
// Quality according to YouTube Video Info: 5081 Kbps
return 5800 * 1000
case VideoResolution.H_4K: // fallthrough
default: