Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2023-05-18 20:05:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e8860918001e1e64db0316d8be43e32c0c99a65e
e8860918
1 parent
754058ae
1.修复一些bug
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
202 additions
and
19 deletions
app/Jobs/AdminMakeImmerse.php
app/Jobs/UserMakeImmerse.php
app/Jobs/AdminMakeImmerse.php
View file @
e886091
...
...
@@ -220,23 +220,63 @@ class AdminMakeImmerse implements ShouldQueue
switch
(
$component
->
name
){
case
'one_poem'
:
$default
=
$this
->
adminMakeVideo
->
poem2
->
title
.
"
\n
"
.
$this
->
adminMakeVideo
->
poem2
->
author
;
$contents
[]
=
$this
->
autoCenter
(
$default
,
$font_size
,
$this
->
output_width
);
$contents
[]
=
[
"text"
=>
$this
->
autoCenter
(
$default
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"title"
];
foreach
(
$this
->
adminMakeVideo
->
poem2
->
verses
as
$item
)
{
$source
=
" "
.
"
\n
"
.
$item
->
source
;
if
(
$item
->
content
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
content
,
$font_size
,
$this
->
output_width
)
.
"
\n
"
.
$this
->
autoCenter
(
$source
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
annotate
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
annotate
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
spelling
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
spelling
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
en
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
en
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
content
){
if
(
$item
->
source
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
content
,
$font_size
,
$this
->
output_width
)
.
"
\n
"
.
$this
->
autoCenter
(
$item
->
source
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"source"
];
}
else
{
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
content
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"content"
];
}
}
// if ($item->content != '') $contents[] = $this->autoEnter($item->content, $font_size, $this->output_width) . "\n" . $this->autoCenter($source, $font_size, $this->output_width);
if
(
$item
->
annotate
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
annotate
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"annotate"
];
}
if
(
$item
->
spelling
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
spelling
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"spelling"
];
}
if
(
$item
->
en
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
en
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"en"
];
}
}
break
;
case
'weather'
:
$contents
[]
=
$this
->
adminMakeVideo
->
weather
;
$contents
[]
=
[
"text"
=>
$this
->
adminMakeVideo
->
weather
,
"tag"
=>
"weather"
];
break
;
case
'date'
:
$contents
[]
=
Carbon
::
now
()
->
format
(
'Y年m月d日H时'
);
$contents
[]
=
[
"text"
=>
Carbon
::
now
()
->
format
(
'Y年m月d日H时'
),
"tag"
=>
"date"
];
break
;
case
'feel'
:
$contents
[]
=
$this
->
adminMakeVideo
->
feel
?:
'读此一言,仿佛身临其境。'
;
$contents
[]
=
[
"text"
=>
$this
->
adminMakeVideo
->
feel
?:
'读此一言,仿佛身临其境。'
,
"tag"
=>
"feel"
];
break
;
}
...
...
@@ -247,6 +287,57 @@ class AdminMakeImmerse implements ShouldQueue
foreach
(
$contents
as
$key
=>
$content
){
$DS
=
$key
*
$round
;
$DE
=
$DS
+
$round
;
if
(
$content
[
'tag'
]
==
'title'
){
$arr
=
explode
(
"
\n
"
,
$content
[
'text'
]);
$title
=
$arr
[
0
]
??
" "
;
$author
=
$arr
[
1
]
??
" "
;
// 标题
$text_file
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$title
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x=(w-text_w)/2:y=(h-text_h)/2'
.
':'
.
'", '
;
// 作者
$text_file
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$author
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
/
2
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x=(w-text_w)/2:y=(h-text_h)/2'
.
':'
.
'", '
;
}
elseif
(
$content
[
'tag'
]
==
'source'
){
$arr
=
explode
(
"
\n
"
,
$content
[
'text'
]);
$title
=
$arr
[
0
]
??
" "
;
$author
=
$arr
[
1
]
??
" "
;
//诗句
$text_file
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$title
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
'y='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
1
])
.
':'
.
'", '
;
// 出处
$text_file
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$author
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
/
2
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
'y='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
1
]
+
$font_size
)
.
':'
.
'", '
;
}
else
{
$text_file
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$content
);
$sub_text
.=
'drawtext="'
.
...
...
@@ -258,6 +349,7 @@ class AdminMakeImmerse implements ShouldQueue
'y='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
1
])
.
':'
.
'", '
;
}
}
$drawtext
.=
$sub_text
;
}
...
...
app/Jobs/UserMakeImmerse.php
View file @
e886091
...
...
@@ -513,23 +513,62 @@ class UserMakeImmerse implements ShouldQueue
switch
(
$component
->
name
){
case
'one_poem'
:
$default
=
$this
->
immerse
->
poem2
->
title
.
"
\n
"
.
$this
->
immerse
->
poem2
->
author
;
$contents
[]
=
$this
->
autoCenter
(
$default
,
$font_size
,
$this
->
output_width
);
$contents
[]
=
[
"text"
=>
$this
->
autoCenter
(
$default
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"title"
];
foreach
(
$this
->
immerse
->
poem2
->
verses
as
$item
)
{
if
(
$item
->
content
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
content
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
annotate
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
annotate
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
spelling
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
spelling
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
en
!=
''
)
$contents
[]
=
$this
->
autoEnter
(
$item
->
en
,
$font_size
,
$this
->
output_width
);
if
(
$item
->
content
){
if
(
$item
->
source
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
content
,
$font_size
,
$this
->
output_width
)
.
"
\n
"
.
$this
->
autoCenter
(
$item
->
source
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"source"
];
}
else
{
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
content
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"content"
];
}
}
if
(
$item
->
annotate
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
annotate
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"annotate"
];
}
if
(
$item
->
spelling
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
spelling
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"spelling"
];
}
if
(
$item
->
en
){
$contents
[]
=
[
"text"
=>
$this
->
autoEnter
(
$item
->
en
,
$font_size
,
$this
->
output_width
),
"tag"
=>
"en"
];
}
}
break
;
case
'weather'
:
$contents
[]
=
$this
->
immerse
->
weather
;
$contents
[]
=
[
"text"
=>
$this
->
immerse
->
weather
,
"tag"
=>
"weather"
];
break
;
case
'date'
:
$contents
[]
=
Carbon
::
now
()
->
format
(
'Y年m月d日H时'
);
$contents
[]
=
[
"text"
=>
Carbon
::
now
()
->
format
(
'Y年m月d日H时'
),
"tag"
=>
"date"
];
break
;
case
'feel'
:
$contents
[]
=
$this
->
immerse
->
feel
?:
'读此一言,仿佛身临其境。'
;
$contents
[]
=
[
"text"
=>
$this
->
immerse
->
feel
?:
'读此一言,仿佛身临其境。'
,
"tag"
=>
"feel"
];
break
;
}
...
...
@@ -540,17 +579,69 @@ class UserMakeImmerse implements ShouldQueue
foreach
(
$contents
as
$key
=>
$content
){
$DS
=
$key
*
$round
;
$DE
=
$DS
+
$round
;
if
(
$content
[
'tag'
]
==
'title'
){
$arr
=
explode
(
"
\n
"
,
$content
[
'text'
]);
$title
=
$arr
[
0
]
??
" "
;
$author
=
$arr
[
1
]
??
" "
;
// 标题
$text_file
=
Storage
::
disk
(
'public'
)
->
path
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$title
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x=(w-text_w)/2:y=(h-text_h)/2'
.
':'
.
'", '
;
// 作者
$text_file
=
Storage
::
disk
(
'public'
)
->
path
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$author
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
/
2
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x=(w-text_w)/2:y=(h-text_h)/2+'
.
$font_size
.
':'
.
'", '
;
}
elseif
(
$content
[
'tag'
]
==
'source'
){
$arr
=
explode
(
"
\n
"
,
$content
[
'text'
]);
$title
=
$arr
[
0
]
??
" "
;
$author
=
$arr
[
1
]
??
" "
;
//诗句
$text_file
=
Storage
::
disk
(
'public'
)
->
path
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$title
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
'y='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
1
])
.
':'
.
'", '
;
// 出处
$text_file
=
Storage
::
disk
(
'public'
)
->
path
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$author
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$font_size
/
2
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
'y='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
1
]
+
$font_size
)
.
':'
.
'", '
;
}
else
{
$text_file
=
Storage
::
disk
(
'public'
)
->
path
(
$this
->
getTempPath
(
'.txt'
,
'text'
));
file_put_contents
(
$text_file
,
$content
);
$sub_text
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font_file
)
.
':'
.
'textfile='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$this
->
calcFontSize
(
$component
->
font_size
)
.
':'
.
'fontsize='
.
$font_size
.
':'
.
'fontcolor_expr='
.
escapeshellarg
(
$text_color
.
'%{eif\\\\: clip(255*(1*between(t\\, '
.
$DS
.
' + '
.
$FID
.
'\\, '
.
$DE
.
' - '
.
$FOD
.
') + ((t - '
.
$DS
.
')/'
.
$FID
.
')*between(t\\, '
.
$DS
.
'\\, '
.
$DS
.
' + '
.
$FID
.
') + (-(t - '
.
$DE
.
')/'
.
$FOD
.
')*between(t\\, '
.
$DE
.
' - '
.
$FOD
.
'\\, '
.
$DE
.
'))\\, 0\\, 255) \\\\: x\\\\: 2 }'
)
.
':'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
'y='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
1
])
.
':'
.
'", '
;
}
}
$drawtext
.=
$sub_text
;
}
...
...
Please
register
or
login
to post a comment