Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
69d5e0b3
Commit
69d5e0b3
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Uploading of videos to peertube via syncthing
parent
b8c927a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-peertube
+65
-0
65 additions, 0 deletions
src/freedombone-app-peertube
with
65 additions
and
0 deletions
src/freedombone-app-peertube
+
65
−
0
View file @
69d5e0b3
...
...
@@ -54,6 +54,61 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME
ARCHITECTURE
MY_EMAIL_ADDRESS
)
function
peertube_import_from_syncthing
{
{
echo
'#!/bin/bash'
;
echo
''
;
echo
"MY_USERNAME=
\$
(cat /root/
${
PROJECT_NAME
}
.cfg | grep MY_USERNAME | awk -F '=' '{print
\$
2}')"
;
echo
"if [ !
\"\$
MY_USERNAME
\"
]; then"
;
echo
' exit 0'
;
echo
'fi'
;
echo
''
;
echo
"search_dir=/home/
\$
MY_USERNAME/Sync/peertube_upload"
;
echo
"if [ ! -f
\$
search_dir/login ]; then"
;
echo
' exit 0'
;
echo
'fi'
;
echo
"import_script=
${
PEERTUBE_DIR
}
/dist/server/tools/upload.js"
;
echo
"if [ ! -f
\$
import_script ]; then"
;
echo
' exit 0'
;
echo
'fi'
;
echo
''
;
echo
"peertubedomain=
\"
http://localhost:
${
PEERTUBE_PORT
}
\"
"
;
echo
"peertubeuser=
\$
(sed -n 1p <
\"\$
search_dir/login
\"
)"
;
echo
"peertubepassword=
\$
(sed -n 2p <
\"\$
search_dir/login
\"
)"
;
echo
'peertubensfw='
;
echo
"if grep 'nsfw'
\"\$
search_dir/login
\"
; then"
;
echo
" peertubensfw='--nsfw'"
;
echo
'fi'
;
echo
''
;
echo
'failed_uploads=0'
;
echo
''
;
echo
"for video_file in
\$
search_dir/*; do"
;
echo
" echo
\"\$
video_file
\"
"
;
echo
" if [[
\"\$
video_file
\"
== *'.ogv' ||
\"\$
video_file
\"
== *'.mp4' ||
\"\$
video_file
\"
== *'.webm' ]]; then"
;
echo
" cd
${
PEERTUBE_DIR
}
|| exit 32468356"
;
echo
" "
;
echo
" if ! grep
\"\$
video_file
\"
/root/.peertube_uploaded; then"
;
echo
" if ! grep
\"\$
video_file
\"
/root/.peertube_uploading; then"
;
echo
" echo
\"\$
video_file
\"
>> /root/.peertube_uploading"
;
echo
" if node
\$
import_script
\$
peertubensfw -u
\"\$
peertubedomain
\"
-U
\"\$
peertubeuser
\"
--password
\"\$
peertubepassword
\"
-f
\"\$
video_file
\"
; then"
;
echo
" echo
\"\$
video_file
\"
>> /root/.peertube_uploaded"
;
echo
" sed -i
\"
/
\$
video_file/d
\"
/root/.peertube_uploading"
;
echo
" exit 0"
;
echo
' else'
;
echo
" sed -i
\"
/
\$
video_file/d
\"
/root/.peertube_uploading"
;
echo
" failed_uploads=
\$
((failed_uploads+1))"
;
echo
" if [
\$
failed_uploads -gt 1 ]; then"
;
echo
' exit 0'
;
echo
' fi'
;
echo
' fi'
;
echo
' fi'
;
echo
' fi'
;
echo
' fi'
;
echo
'done'
;
}
>
/usr/bin/peertubesync
chmod
+x /usr/bin/peertubesync
cron_add_mins 1 /usr/bin/peertubesync
}
function
peertube_create_database
{
if
[
-f
"
$IMAGE_PASSWORD_FILE
"
]
;
then
PEERTUBE_ADMIN_PASSWORD
=
"
$(
printf
"%s"
"
$(
cat
"
$IMAGE_PASSWORD_FILE
"
)
"
)
"
...
...
@@ -326,6 +381,8 @@ function reconfigure_peertube {
}
function
upgrade_peertube
{
peertube_import_from_syncthing
CURR_PEERTUBE_COMMIT
=
$(
get_completion_param
"peertube commit"
)
if
[[
"
$CURR_PEERTUBE_COMMIT
"
==
"
$PEERTUBE_COMMIT
"
]]
;
then
return
...
...
@@ -479,6 +536,14 @@ function remove_peertube {
remove_onion_service peertube
${
PEERTUBE_ONION_PORT
}
remove_completion_param
"install_peertube"
sed
-i
'/peertube/d'
"
$COMPLETION_FILE
"
sed
-i
'/peertubesync/d'
/etc/crontab
if
[
-f
/usr/bin/peertubesync
]
;
then
rm
/usr/bin/peertubesync
fi
if
[
-f
/root/peertube_uploaded
]
;
then
rm
/root/peertube_uploaded
fi
function_check drop_database_postgresql
drop_database_postgresql peertube peertube
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment