File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed
Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 9999 <entry name =" RandomMode" type =" Bool" >
100100 <default >False</default >
101101 </entry >
102- <entry name =" LastVideoIndex " type =" Int " >
103- <default >0 </default >
102+ <entry name =" LastVideo " type =" String " >
103+ <default ></default >
104104 </entry >
105105 <entry name =" LastVideoPosition" type =" Int" >
106106 <default >0</default >
126126 <default >0</default >
127127 </entry >
128128 <entry name =" ResumeLastVideo" type =" Bool" >
129- <label >Whether or not resume last playing video on startup</label >
129+ <label >Whether or not to resume last playing video on startup</label >
130130 <default >True</default >
131131 </entry >
132132 </group >
Original file line number Diff line number Diff line change @@ -268,6 +268,9 @@ Item {
268268 PlasmaComponents .Label {
269269 text: root .player .source
270270 }
271+ PlasmaComponents .Label {
272+ text: main .currentVideoIndex
273+ }
271274 PlasmaComponents .Label {
272275 text: " changeWallpaperMode " + root .changeWallpaperMode
273276 }
Original file line number Diff line number Diff line change @@ -32,6 +32,27 @@ function createVideo(filename) {
3232 } ;
3333}
3434
35+ /**
36+ *
37+ * @param {String } filename File path
38+ * @param {Array } videosConfig Videos config
39+ * @returns {Object } Video properties
40+ */
41+ function getVideoByFile ( filename , videosConfig ) {
42+ const video = videosConfig . find ( ( video ) => video . filename === filename ) ;
43+ return video ?? createVideo ( "" ) ;
44+ }
45+
46+ /**
47+ *
48+ * @param {int } index Video index
49+ * @param {Array } videosConfig Videos config
50+ * @returns {Object } Video properties
51+ */
52+ function getVideoByIndex ( index , videosConfig ) {
53+ return videosConfig . length > 0 ? videosConfig [ index ] : createVideo ( "" ) ;
54+ }
55+
3556function dumpProps ( obj ) {
3657 console . log ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" ) ;
3758 for ( var k of Object . keys ( obj ) ) {
Original file line number Diff line number Diff line change @@ -34,8 +34,14 @@ WallpaperItem {
3434 property bool isLoading: true
3535 property string videoUrls: main .configuration .VideoUrls
3636 property var videosConfig: getVideos ()
37- property int currentVideoIndex: main .configuration .LastVideoIndex < videosConfig .length ? main .configuration .LastVideoIndex : 0
38- property var currentSource: videosConfig .length > 0 ? videosConfig[currentVideoIndex] : Utils .createVideo (" " )
37+ property int currentVideoIndex: 0
38+ property bool resumeLastVideo: main .configuration .ResumeLastVideo
39+ property var currentSource: {
40+ if (resumeLastVideo && main .configuration .LastVideo !== " " ) {
41+ return Utils .getVideoByFile (main .configuration .LastVideo , videosConfig);
42+ }
43+ return Utils .getVideoByIndex (currentVideoIndex, videosConfig);
44+ }
3945 property int pauseBatteryLevel: main .configuration .PauseBatteryLevel
4046 property bool shouldPlay: {
4147 if (lockScreenMode) {
@@ -351,7 +357,7 @@ WallpaperItem {
351357
352358 function save () {
353359 // Save last video and position to resume from it on next login/lock
354- main .configuration .LastVideoIndex = main .currentVideoIndex ;
360+ main .configuration .LastVideo = main .currentSource . filename ;
355361 main .configuration .LastVideoPosition = player .lastVideoPosition ;
356362 main .configuration .writeConfig ();
357363 printLog (" Bye!" );
You can’t perform that action at this time.
0 commit comments