Skip to content

Commit d5bc0cd

Browse files
Merge remote-tracking branch 'upstream/development' into development
# Conflicts: # yarn.lock
2 parents ec906ef + 687352f commit d5bc0cd

File tree

13 files changed

+205
-212
lines changed

13 files changed

+205
-212
lines changed

.github/workflows/flatpak.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v3
1919
with:
2020
repository: flathub/io.freetubeapp.FreeTube
21-
token: ${{ secrets.PUSH_TOKEN }}
21+
token: ${{ secrets.FLATHUB_TOKEN }}
2222
- name: GitHub API exec action
2323
uses: moustacheful/github-api-exec-action@v0
2424
id: api_results
@@ -77,22 +77,22 @@ jobs:
7777
date +"%Y-%m-%d" >> $GITHUB_ENV
7878
echo 'EOF' >> $GITHUB_ENV
7979
- name: Update x64 File Location in yml File
80-
uses: mikefarah/yq@v4.27.5
80+
uses: mikefarah/yq@v4.28.1
8181
with:
8282
# The Command which should be run
8383
cmd: yq w -i io.freetubeapp.FreeTube.yml modules[0].sources[0].url 'https://github.com/FreeTubeApp/FreeTube/releases/download/v${{ steps.sub.outputs.result }}-beta/freetube-${{ steps.sub.outputs.result }}-linux-portable-x64.zip'
8484
- name: Update x64 Hash in yml File
85-
uses: mikefarah/yq@v4.27.5
85+
uses: mikefarah/yq@v4.28.1
8686
with:
8787
# The Command which should be run
8888
cmd: yq w -i io.freetubeapp.FreeTube.yml modules[0].sources[0].sha256 ${{ env.HASH_X64 }}
8989
- name: Update ARM File Location in yml File
90-
uses: mikefarah/yq@v4.27.5
90+
uses: mikefarah/yq@v4.28.1
9191
with:
9292
# The Command which should be run
9393
cmd: yq w -i io.freetubeapp.FreeTube.yml modules[0].sources[1].url 'https://github.com/FreeTubeApp/FreeTube/releases/download/v${{ steps.sub.outputs.result }}-beta/freetube-${{ steps.sub.outputs.result }}-linux-portable-arm64.zip'
9494
- name: Update ARM Hash in yml File
95-
uses: mikefarah/yq@v4.27.5
95+
uses: mikefarah/yq@v4.28.1
9696
with:
9797
# The Command which should be run
9898
cmd: yq w -i io.freetubeapp.FreeTube.yml modules[0].sources[1].sha256 ${{ env.HASH_ARM64 }}
@@ -108,7 +108,7 @@ jobs:
108108
# Optional but recommended
109109
# Defaults to "Apply automatic changes"
110110
commit_message: Update files for v${{ steps.sub.outputs.result }}
111-
token: ${{ secrets.PUSH_TOKEN }}
111+
token: ${{ secrets.FLATHUB_TOKEN }}
112112

113113
# Optional options appended to `git-commit`
114114
# See https://git-scm.com/docs/git-commit for a list of available options
@@ -118,7 +118,7 @@ jobs:
118118
skip_dirty_check: true
119119
- name: Create PR
120120
run: |
121-
echo ${{ secrets.PUSH_TOKEN }} >> auth.txt
121+
echo ${{ secrets.FLATHUB_TOKEN }} >> auth.txt
122122
gh auth login --with-token < auth.txt
123123
rm auth.txt
124124
gh pr create --title "Release v${{ steps.sub.outputs.result }}" --body "This is an automated PR for the v${{ steps.sub.outputs.result }} release. This PR will be updated and merged once testing is complete."

.github/workflows/report.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Project Board Automation
44

55
on:
66
issues:
7-
types: [labeled, unlabeled, closed, deleted]
7+
types: [closed, deleted, reopened, opened]
88

99
jobs:
1010
assign-issues-to-projects:
@@ -14,37 +14,57 @@ jobs:
1414
# For bug reports
1515
- name: New bug issue
1616
uses: alex-page/[email protected]
17-
if: github.event.action == 'labeled' && contains(github.event.issue.labels.*.name, 'bug')
17+
if: contains(github.event.issue.labels.*.name, 'bug') && github.event.action == 'opened'
1818
with:
1919
project: Bug Reports
2020
column: To assign
2121
repo-token: ${{ secrets.PUSH_TOKEN }}
2222
action: update
23-
24-
- name: Bug label removed
23+
24+
- name: Bug issue closed
2525
uses: alex-page/[email protected]
26-
if: github.event.action == 'unlabeled' || github.event.action == 'closed' || github.event.action == 'deleted'
26+
if: github.event.action == 'closed' || github.event.action == 'deleted'
2727
with:
2828
action: delete
2929
project: Bug Reports
3030
column: To assign
3131
repo-token: ${{ secrets.PUSH_TOKEN }}
32+
33+
- name: Bug issue reopened
34+
uses: alex-page/[email protected]
35+
if: contains(github.event.issue.labels.*.name, 'bug') && github.event.action == 'reopened'
36+
with:
37+
project: Bug Reports
38+
column: To assign
39+
repo-token: ${{ secrets.PUSH_TOKEN }}
40+
action: update
3241

3342
# For feature requests
3443
- name: New feature issue
3544
uses: alex-page/[email protected]
36-
if: github.event.action == 'labeled' && contains(github.event.issue.labels.*.name, 'enhancement')
45+
if: contains(github.event.issue.labels.*.name, 'enhancement') && github.event.action == 'opened'
3746
with:
3847
project: Feature Requests
3948
column: To assign
4049
repo-token: ${{ secrets.PUSH_TOKEN }}
4150
action: update
4251

43-
- name: Feature request label removed
52+
- name: Feature request issue closed
4453
uses: alex-page/[email protected]
45-
if: github.event.action == 'unlabeled' || github.event.action == 'closed' || github.event.action == 'deleted'
54+
if: github.event.action == 'closed' || github.event.action == 'deleted'
4655
with:
4756
action: delete
4857
project: Feature Requests
4958
column: To assign
5059
repo-token: ${{ secrets.PUSH_TOKEN }}
60+
61+
- name: Feature request issue reopened
62+
uses: alex-page/[email protected]
63+
if: contains(github.event.issue.labels.*.name, 'enhancement') && github.event.action == 'reopened'
64+
with:
65+
project: Feature Requests
66+
column: To assign
67+
repo-token: ${{ secrets.PUSH_TOKEN }}
68+
action: update
69+
70+

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"vue-router": "^3.6.5",
8282
"vuex": "^3.6.2",
8383
"youtube-suggest": "^1.2.0",
84-
"yt-channel-info": "^3.1.0",
84+
"yt-channel-info": "^3.1.1",
8585
"yt-dash-manifest-generator": "1.1.0",
8686
"ytdl-core": "^4.11.2",
8787
"ytpl": "^2.3.0",
@@ -112,8 +112,8 @@
112112
"html-webpack-plugin": "^5.3.2",
113113
"js-yaml": "^4.1.0",
114114
"json-minimizer-webpack-plugin": "^4.0.0",
115-
"lefthook": "^1.1.1",
116-
"mini-css-extract-plugin": "^2.2.2",
115+
"lefthook": "^1.1.2",
116+
"mini-css-extract-plugin": "^2.6.1",
117117
"npm-run-all": "^4.1.5",
118118
"prettier": "^2.3.2",
119119
"rimraf": "^3.0.2",

src/renderer/components/data-settings/data-settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MAIN_PROFILE_ID } from '../../../constants'
1111
import fs from 'fs'
1212
import { opmlToJSON } from 'opml-to-json'
1313
import ytch from 'yt-channel-info'
14+
import { calculateColorLuminance } from '../../helpers/utils'
1415

1516
// FIXME: Missing web logic branching
1617

@@ -1092,7 +1093,7 @@ export default Vue.extend({
10921093
let index = convertedData.findIndex(p => p.name === profile.value)
10931094
if (index === -1) { // profile doesn't exist yet
10941095
const randomBgColor = await this.getRandomColor()
1095-
const contrastyTextColor = await this.calculateColorLuminance(randomBgColor)
1096+
const contrastyTextColor = calculateColorLuminance(randomBgColor)
10961097
convertedData.push({
10971098
name: profile.value,
10981099
bgColor: randomBgColor,
@@ -1241,7 +1242,6 @@ export default Vue.extend({
12411242
'compactHistory',
12421243
'showToast',
12431244
'getRandomColor',
1244-
'calculateColorLuminance',
12451245
'showOpenDialog',
12461246
'readFileFromDialog',
12471247
'showSaveDialog',

src/renderer/components/ft-profile-edit/ft-profile-edit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue'
66
import FtInput from '../../components/ft-input/ft-input.vue'
77
import FtButton from '../../components/ft-button/ft-button.vue'
88
import { MAIN_PROFILE_ID } from '../../../constants'
9+
import { calculateColorLuminance } from '../../helpers/utils'
910

1011
export default Vue.extend({
1112
name: 'FtProfileEdit',
@@ -70,8 +71,8 @@ export default Vue.extend({
7071
}
7172
},
7273
watch: {
73-
profileBgColor: async function (val) {
74-
this.profileTextColor = await this.calculateColorLuminance(val)
74+
profileBgColor: function (val) {
75+
this.profileTextColor = calculateColorLuminance(val)
7576
}
7677
},
7778
created: function () {
@@ -163,8 +164,7 @@ export default Vue.extend({
163164
'updateProfile',
164165
'removeProfile',
165166
'updateDefaultProfile',
166-
'updateActiveProfile',
167-
'calculateColorLuminance'
167+
'updateActiveProfile'
168168
])
169169
}
170170
})

src/renderer/components/ft-video-player/ft-video-player.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'videojs-http-source-selector'
1414

1515
import { IpcChannels } from '../../../constants'
1616
import { sponsorBlockSkipSegments } from '../../helpers/sponsorblock'
17+
import { calculateColorLuminance } from '../../helpers/utils'
1718

1819
export default Vue.extend({
1920
name: 'FtVideoPlayer',
@@ -1175,7 +1176,7 @@ export default Vue.extend({
11751176
videojs.registerComponent('loopButton', loopButton)
11761177
},
11771178

1178-
toggleVideoLoop: async function () {
1179+
toggleVideoLoop: function () {
11791180
const loopButton = document.getElementById('loopButton')
11801181

11811182
if (!this.player.loop()) {
@@ -1187,7 +1188,7 @@ export default Vue.extend({
11871188
return color === currentTheme
11881189
})
11891190

1190-
const themeTextColor = await this.calculateColorLuminance(colorValues[nameIndex])
1191+
const themeTextColor = calculateColorLuminance(colorValues[nameIndex])
11911192

11921193
loopButton.classList.add('vjs-icon-loop-active')
11931194

@@ -1923,7 +1924,6 @@ export default Vue.extend({
19231924
},
19241925

19251926
...mapActions([
1926-
'calculateColorLuminance',
19271927
'updateDefaultCaptionSettings',
19281928
'showToast',
19291929
'parseScreenshotCustomFileName',

src/renderer/helpers/utils.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
export function calculateColorLuminance(colorValue) {
2+
const cutHex = colorValue.substring(1, 7)
3+
const colorValueR = parseInt(cutHex.substring(0, 2), 16)
4+
const colorValueG = parseInt(cutHex.substring(2, 4), 16)
5+
const colorValueB = parseInt(cutHex.substring(4, 6), 16)
6+
7+
const luminance = (0.299 * colorValueR + 0.587 * colorValueG + 0.114 * colorValueB) / 255
8+
9+
if (luminance > 0.5) {
10+
return '#000000'
11+
} else {
12+
return '#FFFFFF'
13+
}
14+
}
15+
16+
export function calculatePublishedDate(publishedText) {
17+
const date = new Date()
18+
if (publishedText === 'Live') {
19+
return publishedText
20+
}
21+
22+
const textSplit = publishedText.split(' ')
23+
24+
if (textSplit[0].toLowerCase() === 'streamed') {
25+
textSplit.shift()
26+
}
27+
28+
const timeFrame = textSplit[1]
29+
const timeAmount = parseInt(textSplit[0])
30+
let timeSpan = null
31+
32+
if (timeFrame.indexOf('second') > -1) {
33+
timeSpan = timeAmount * 1000
34+
} else if (timeFrame.indexOf('minute') > -1) {
35+
timeSpan = timeAmount * 60000
36+
} else if (timeFrame.indexOf('hour') > -1) {
37+
timeSpan = timeAmount * 3600000
38+
} else if (timeFrame.indexOf('day') > -1) {
39+
timeSpan = timeAmount * 86400000
40+
} else if (timeFrame.indexOf('week') > -1) {
41+
timeSpan = timeAmount * 604800000
42+
} else if (timeFrame.indexOf('month') > -1) {
43+
timeSpan = timeAmount * 2592000000
44+
} else if (timeFrame.indexOf('year') > -1) {
45+
timeSpan = timeAmount * 31556952000
46+
}
47+
48+
return date.getTime() - timeSpan
49+
}
50+
51+
export function buildVTTFileLocally(storyboard) {
52+
let vttString = 'WEBVTT\n\n'
53+
// how many images are in one image
54+
const numberOfSubImagesPerImage = storyboard.sWidth * storyboard.sHeight
55+
// the number of storyboard images
56+
const numberOfImages = Math.ceil(storyboard.count / numberOfSubImagesPerImage)
57+
const intervalInSeconds = storyboard.interval / 1000
58+
let currentUrl = storyboard.url
59+
let startHours = 0
60+
let startMinutes = 0
61+
let startSeconds = 0
62+
let endHours = 0
63+
let endMinutes = 0
64+
let endSeconds = intervalInSeconds
65+
for (let i = 0; i < numberOfImages; i++) {
66+
let xCoord = 0
67+
let yCoord = 0
68+
for (let j = 0; j < numberOfSubImagesPerImage; j++) {
69+
// add the timestamp information
70+
const paddedStartHours = startHours.toString().padStart(2, '0')
71+
const paddedStartMinutes = startMinutes.toString().padStart(2, '0')
72+
const paddedStartSeconds = startSeconds.toString().padStart(2, '0')
73+
const paddedEndHours = endHours.toString().padStart(2, '0')
74+
const paddedEndMinutes = endMinutes.toString().padStart(2, '0')
75+
const paddedEndSeconds = endSeconds.toString().padStart(2, '0')
76+
vttString += `${paddedStartHours}:${paddedStartMinutes}:${paddedStartSeconds}.000 --> ${paddedEndHours}:${paddedEndMinutes}:${paddedEndSeconds}.000\n`
77+
// add the current image url as well as the x, y, width, height information
78+
vttString += currentUrl + `#xywh=${xCoord},${yCoord},${storyboard.width},${storyboard.height}\n\n`
79+
// update the variables
80+
startHours = endHours
81+
startMinutes = endMinutes
82+
startSeconds = endSeconds
83+
endSeconds += intervalInSeconds
84+
if (endSeconds >= 60) {
85+
endSeconds -= 60
86+
endMinutes += 1
87+
}
88+
if (endMinutes >= 60) {
89+
endMinutes -= 60
90+
endHours += 1
91+
}
92+
// x coordinate can only be smaller than the width of one subimage * the number of subimages per row
93+
xCoord = (xCoord + storyboard.width) % (storyboard.width * storyboard.sWidth)
94+
// only if the x coordinate is , so in a new row, we have to update the y coordinate
95+
if (xCoord === 0) {
96+
yCoord += storyboard.height
97+
}
98+
}
99+
// make sure that there is no value like M0 or M1 in the parameters that gets replaced
100+
currentUrl = currentUrl.replace('M' + i.toString() + '.jpg', 'M' + (i + 1).toString() + '.jpg')
101+
}
102+
return vttString
103+
}

src/renderer/store/modules/profiles.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { MAIN_PROFILE_ID } from '../../../constants'
22
import { DBProfileHandlers } from '../../../datastores/handlers/index'
3+
import { calculateColorLuminance } from '../../helpers/utils'
34

45
const state = {
56
profileList: [{
@@ -53,7 +54,7 @@ const actions = {
5354
if (profiles.length === 0) {
5455
// Create a default profile and persist it
5556
const randomColor = await dispatch('getRandomColor')
56-
const textColor = await dispatch('calculateColorLuminance', randomColor)
57+
const textColor = calculateColorLuminance(randomColor)
5758
const defaultProfile = {
5859
_id: MAIN_PROFILE_ID,
5960
name: defaultName,

0 commit comments

Comments
 (0)