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
30f6c1fc
Commit
30f6c1fc
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Fixing peertube video sync
parent
1580564f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-app-peertube
+28
-7
28 additions, 7 deletions
src/freedombone-app-peertube
src/freedombone-syncthing
+3
-3
3 additions, 3 deletions
src/freedombone-syncthing
with
31 additions
and
10 deletions
src/freedombone-app-peertube
+
28
−
7
View file @
30f6c1fc
...
...
@@ -55,6 +55,14 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME
MY_EMAIL_ADDRESS
)
function
peertube_import_from_syncthing
{
peertubedomain
=
"https://
$PEERTUBE_DOMAIN_NAME
"
nodecmd
=
'node'
if
[[
"
$ONION_ONLY
"
!=
'no'
]]
;
then
peertubedomain
=
"http://
$(
cat
/var/lib/tor/hidden_service_peertube/hostname
)
"
nodecmd
=
'torsocks node'
fi
{
echo
'#!/bin/bash'
;
echo
''
;
echo
"MY_USERNAME=
\$
(cat /root/
${
PROJECT_NAME
}
.cfg | grep MY_USERNAME | awk -F '=' '{print
\$
2}')"
;
...
...
@@ -71,7 +79,7 @@ function peertube_import_from_syncthing {
echo
' exit 0'
;
echo
'fi'
;
echo
''
;
echo
"peertubedomain=
\"
http://localhost:
${
PEERTUBE_PORT
}
\"
"
;
echo
"peertubedomain=
\"
$peertubedomain
\"
"
;
echo
"peertubeuser=
\$
(sed -n 1p <
\"\$
search_dir/login.txt
\"
)"
;
echo
"peertubepassword=
\$
(sed -n 2p <
\"\$
search_dir/login.txt
\"
)"
;
echo
'peertubensfw='
;
...
...
@@ -100,7 +108,8 @@ function peertube_import_from_syncthing {
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
\$
peertubeprivate -u
\"\$
peertubedomain
\"
-U
\"\$
peertubeuser
\"
--password
\"\$
peertubepassword
\"
-f
\"\$
video_file
\"
; then"
;
echo
" peertubetitle=
\$
(basename
\"\$
video_file
\"
| awk -F '.' '{print
\$
1}' | sed 's|_| |g' | sed 's|-| |g')"
;
echo
" if
$nodecmd
\$
import_script -n
\$
peertubetitle
\$
peertubensfw
\$
peertubeprivate -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"
;
...
...
@@ -242,7 +251,13 @@ function peertube_import_from_file {
peertubensfw
=
$(
sed
-n
4p <
"
$data2
"
)
rm
-f
"
$data2
"
peertubedomain
=
"http://localhost:
${
PEERTUBE_PORT
}
"
peertubedomain
=
"https://
$PEERTUBE_DOMAIN_NAME
"
nodecmd
=
'node'
if
[[
"
$ONION_ONLY
"
!=
'no'
]]
;
then
peertubedomain
=
"http://
$(
cat
/var/lib/tor/hidden_service_peertube/hostname
)
"
nodecmd
=
'torsocks node'
fi
data2
=
$(
mktemp
2>/dev/null
)
dialog
--title
"Choose the video file (select with spacebar)"
--fselect
"/home/
$MY_USERNAME
/"
30 60 2>
"
$data2
"
...
...
@@ -270,13 +285,13 @@ function peertube_import_from_file {
nsfwstr
=
'--nsfw'
fi
titlestr
=
titlestr
=
$(
basename
"
$selected_file
"
|
awk
-F
'.'
'{print $1}'
|
sed
's|_| |g'
|
sed
's|-| |g'
)
if
[
"
$peertubetitle
"
]
;
then
titlestr
=
"-n
\"
$peertubetitle
\"
"
fi
clear
node
$import_script
$nsfwstr
"
$titlestr
"
-u
"
$peertubedomain
"
-U
"
$peertubeuser
"
--password
"
$peertubepassword
"
-f
"
$selected_file
"
$
node
cmd
$import_script
$nsfwstr
"
$titlestr
"
-u
"
$peertubedomain
"
-U
"
$peertubeuser
"
--password
"
$peertubepassword
"
-f
"
$selected_file
"
dialog
--title
$"Import video from file"
\
--msgbox
$"Video imported from
$selected_file
"
6 75
...
...
@@ -307,7 +322,13 @@ function peertube_import_videos {
video_url
=
$(
sed
-n
3p <
"
$data2
"
)
rm
-f
"
$data2
"
peertubedomain
=
"http://localhost:
${
PEERTUBE_PORT
}
"
peertubedomain
=
"https://
$PEERTUBE_DOMAIN_NAME
"
nodecmd
=
'node'
if
[[
"
$ONION_ONLY
"
!=
'no'
]]
;
then
peertubedomain
=
"http://
$(
cat
/var/lib/tor/hidden_service_peertube/hostname
)
"
nodecmd
=
'torsocks node'
fi
if
[
${#
peertubeuser
}
-lt
3
]
;
then
dialog
--title
$"Import videos from legacy sites"
\
...
...
@@ -342,7 +363,7 @@ function peertube_import_videos {
fi
clear
node
$import_script
-u
"
$peertubedomain
"
-U
"
$peertubeuser
"
--password
"
$peertubepassword
"
-t
"
$video_url
"
$
node
cmd
$import_script
-u
"
$peertubedomain
"
-U
"
$peertubeuser
"
--password
"
$peertubepassword
"
-t
"
$video_url
"
dialog
--title
$"Import videos from legacy sites"
\
--msgbox
$"Video/s imported from
$video_url
"
6 75
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-syncthing
+
3
−
3
View file @
30f6c1fc
...
...
@@ -113,7 +113,7 @@ function create_syncthing_config {
if
[
-f
"/home/
$USERNAME
/
$SYNCTHING_USER_IDS_FILE
"
]
;
then
echo
""
>
$TEMP_IDS_FILE
while
read
-r
line
||
[[
-n
"
$line
"
]]
;
do
line2
=
"
$(
echo
-e
"
${
line
}
"
|
sed
-e
's/^[[:space:]]*//'
-e
's/[[:space:]]*$//'
)
"
line2
=
$(
echo
-e
"
${
line
}
"
|
sed
-e
's/^[[:space:]]*//'
-e
's/[[:space:]]*$//'
)
if
[[
$line2
!=
*
"#"
*
&&
$line2
!=
*
"*"
*
&&
$line2
!=
*
'/'
*
&&
$line2
==
*
"-"
*
]]
;
then
if
[
${#
line2
}
-gt
10
]
;
then
if
!
grep
-q
"
$line2
"
$TEMP_IDS_FILE
;
then
...
...
@@ -150,7 +150,7 @@ function create_syncthing_config {
if
[[
$(
is_valid_user
"
$USERNAME
"
)
==
"1"
]]
;
then
if
[
-f
"/home/
$USERNAME
/
$SYNCTHING_USER_IDS_FILE
"
]
;
then
while
read
-r
line
||
[[
-n
"
$line
"
]]
;
do
line2
=
"
$(
echo
-e
"
${
line
}
"
|
sed
-e
's/^[[:space:]]*//'
-e
's/[[:space:]]*$//'
)
"
line2
=
$(
echo
-e
"
${
line
}
"
|
sed
-e
's/^[[:space:]]*//'
-e
's/[[:space:]]*$//'
)
if
[[
$line2
!=
*
"#"
*
&&
$line2
!=
*
"*"
*
&&
$line2
!=
*
'/'
*
&&
$line2
==
*
"-"
*
]]
;
then
if
[
${#
line2
}
-gt
10
]
;
then
if
!
grep
-q
"
$line2
"
$TEMP_IDS_FILE
;
then
...
...
@@ -189,7 +189,7 @@ function create_syncthing_config {
if
[[
$(
is_valid_user
"
$USERNAME
"
)
==
"1"
]]
;
then
if
[
-f
"/home/
$USERNAME
/
$SYNCTHING_USER_IDS_FILE
"
]
;
then
while
read
-r
line
||
[[
-n
"
$line
"
]]
;
do
line2
=
"
$(
echo
-e
"
${
line
}
"
|
sed
-e
's/^[[:space:]]*//'
-e
's/[[:space:]]*$//'
)
"
line2
=
$(
echo
-e
"
${
line
}
"
|
sed
-e
's/^[[:space:]]*//'
-e
's/[[:space:]]*$//'
)
if
[[
$line2
!=
*
"#"
*
&&
$line2
!=
*
"*"
*
&&
$line2
!=
*
'/'
*
&&
$line2
==
*
"-"
*
]]
;
then
if
[
${#
line2
}
-gt
10
]
;
then
if
!
grep
-q
"
$line2
"
$TEMP_IDS_FILE
;
then
...
...
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