Movieplayer random play & playlist

Wünsche, Anträge, Fehlermeldungen
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Movieplayer random play & playlist

Beitrag von ozbodd »

I rarely use the audioplayer but often watch music videos saved to my share. Can Movieplayer be adapted to enable playlists and shuffle options like the audioplayer. I have had a look at the code and they seem similar but I know I am way out of my depth there.

Anyone tried this or interested in trying it?
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

Perhaps the playlist option is too much work?

I would be happy if when you are at the file browser stage you could select Random Play menu option and it enumerated/indexed the entire folder you were in and then generated random numbering to play different indexes until halted?
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

Maybe a workaround - if u organize your files in a folder you can play the folder
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

Yes that is what I had in mind, I already do this for other categories Movies/TV/MusicVids etc This is a fairly specific request and it would make the DBox a Video Jukebox - How cool would that be?
Zuletzt geändert von ozbodd am Montag 21. Januar 2008, 17:30, insgesamt 1-mal geändert.
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

but this already works - you can play an folder instead of an single TS File
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

OK I didn't know that? Will try it at home tonight, I guess then the task would be to randomise the files rather than play them sequentially.

@Tommy is that via the MovieBrowser option or the Play TS menu option? Or both?

I find the MovieBrowser enumerates the folder on first run after a boot up and can take 3 -4 minutes to complete.
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

No - over the moviebrowser this didn't work - only over the play TS menu (Filebrowser)

But I don't think that u'll find a developer who implement a random play for video. There a many other things and workgrounds to be fixed before. What u want is more an "nice to have". So it's up to u to bring it in place ;-)
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

:o I'll take a look - When I looked last I couldn't follow how the routines worked, I need to isolate in the code how/where the files are selected to play (by selecting a folder) and see how MP processes them sequentially. Will look tonight but if you know anything please provide me with a start.
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

@Tommy I cannot select an entire folder in Movieplayer Play TS? If I do it just opens to show those files then I have to select individually?? There is no Play Folder option that I can see.

EDIT**********
Never mind I found it - I had to have Multi-select set Yes in the settings - Looks promising.
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

ooops - someone has fixed away this option. Normally the navigation within the filesystem had worked only with curserkeys. An "OK" had played the selected File/Folder. Now the "OK" button opens the folder instead of play it :dash:
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

No it does actually work as you say - You must select 'Multiselect' in the MP settings. It is not very intuitive because it works when you 'OK' the folder (which is normally associated with opening to view) Would be better if you had to Mark the folder first or have another menu item to start Play Folder. I always forget to use the cursor keys in this mode when I just want to open a folder :x . I suspect this is the reason the is an option to turn it off...

I have seen in the terminal that MP makes playlist and I know that in audioplayer the shuffle option uses a routine just to re-order the files in the folder. If the files are stored in an array it should just be a matter of randomising the array indexes, and probably we can use the audioplayer routine if it can be found. - Can't have a good look until Wednesday due to work.
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

I think the code from line 2717+ is where the files are enumerated into an array?

Code: Alles auswählen

       ctx->isStream  = false;
	        ctx->itChanged = false;
	        ctx->lst_cnt   = 0;
         	ctx->it        = 0;
         	for (unsigned int i = 0; (i < PF_LST_ITEMS) && (i < filelist.size()); i++) {
             	ctx->lst[ctx->lst_cnt].pname = filelist[ctx->lst_cnt].Name.c_str();
             	ctx->lst_cnt++;
I am not familiar with this code but I can see where it is counting the files lst_cnt++

Is the following line the building of an array?

Code: Alles auswählen

ctx->lst[ctx->lst_cnt].pname = filelist[ctx->lst_cnt].Name.c_str();
What is ctx->?

If anyone can break some of this down for me it would be appreciated.
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

I'm not a C++ Guru but in Visual Basic it would be an array based on an userdefined type
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

OK - I'm PHP -MySQL - know no c++ and haven't played with visual basic since the late 80's early 90's :o/

So ctx is the array? How is it indexed, for example how do you interregate the elements of the array? I'll do some C++ googling I think.

In php I can print an array with print_r() is there a similar command in c++ that I could get it to print out the array to the terminal?
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

:dash: OK I don't get it - Its too hard :gruebel:

filelist is the array - I think

I can find C++ shuffle classes like http://www.freevbcode.com/ShowCode.asp?ID=7399 but for the life of me I cannot see where and how I could use it.

It doesn't help that I don't know how to edit movieplayer.cpp (other than using Scite text editor on a local file) or make a neutrino to test it. Blah!
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

What about this then?

Is this the code that selects the next playlist item?

Code: Alles auswählen

3023			//-- eventually activate autoplay for next file in a playlist --
3024			if( (ctx->itChanged == false) && ctx->lst_cnt )
				{
					ctx->it++;
					if(ctx->it < ctx->lst_cnt)	ctx->itChanged = true;
                                        fprintf(stderr, "[mp] Playlist item? = [%d]\n", ctx->it );    //Ozbodd - Please insert this line
				}
Could someone please make a diff for the movieplayer.cpp code (preferably also with Seife's patch & my single line commented above) and provide me a neutrino to test. Or show me or point me to a simple tut on how I do this.

I am wondering if I can randomise %it% here, and perhaps maintain all used indexes in an new array to check and prevent duplicate plays. Just need to see in the terminal if this is where it sets the next playlist item.

Cheers
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

Code: Alles auswählen

3023				//-- eventually activate autoplay for next file in a playlist --
3024				if( (ctx->itChanged == false) && ctx->lst_cnt )
3025				{
3026				    g_settings_streaming_allow_random == true;						//Ozbodd - Hardcoded to test only; want a MP setting in conf- Jan08
3027				    if (!g_settings_streaming_allow_random)   						    //Ozbodd - Can I add a new MP Setting to the .conf file? - Jan08
3028					{			
3029						ctx->it++;
3030						if(ctx->it < ctx->lst_cnt)	ctx->itChanged = true;
3031						fprintf(stderr, "[mp] Playlist item? = [%d]\n", ctx->it );    		    //Ozbodd - Jan08
3032					} else {									                 //Ozbodd - Jan08
3033						//-- This will probably just play random files indefinitely with repeats until [Home key] to exit
3034						srand(time(0));								              //Ozbodd - Jan08
3035						ctx->it = rand() % ctx->lst_cnt + 1; 					      //Ozbodd - generates random number between 1 and lst_cnt - Jan08
3036						ctx->itChanged = true;							          //Ozbodd - Jan08
3037						fprintf(stderr, "[mp] Random playlist item? = [%d]\n", ctx->it );    	//Ozbodd - Jan08
3038					}                                                                                                 //Ozbodd - Jan08
3039				}
OK I think this may work (but need a diff to test please).
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

Why you don't set up an environment to compile urself? If u havn't a Linux OS u can take a VMWare distribution http://www.tuxbox-cvs.sourceforge.net/upload/kubuntu/ which is nearly ready for creating Images or compile parts of neutrino. Also yBuild is recommended because it's a scrpit based assistant which makes u able to build an image without any knowledge of things happen in the background.
If u get trouble with building images u can ask in the CVS Section in this Forum
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

OK I probably can but have no idea how without a guide. I have Ubuntu Gutsy already in VMWrae so no problems there, most of this forum is in German. I'll DL that version and have a look, Thanks

Also is this done on a raw image or can it be done with an image that is localised and modded already?

Would have been useful to get that change in a neutrino just to see if I am on the right track b4 I start learning stuff from the beginning...
seife
Developer
Beiträge: 4189
Registriert: Sonntag 2. November 2003, 12:36

Re: Movieplayer random play & playlist

Beitrag von seife »

There is a good guide in english on how to do image builds (and if you can build an image, you also built the neutrino binary ;) ) on barf's newmake page:
http://www.bengt-martensson.de/dbox2/fl ... wmake.html
Using any linux distribution is fine, does not really matter if it runs native or in vmware.
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

:o I was afraid of that!!!!!!! Thanks Seife... You guys like to push people into modding :wink:

I'll give it a go but judging by the guide I don't think I am going to have the patience to nut that out.
Tommy
Tuxboxer
Tuxboxer
Beiträge: 4332
Registriert: Dienstag 7. Mai 2002, 17:04

Re: Movieplayer random play & playlist

Beitrag von Tommy »

This forum (any forum) should be "help to selfhelp". Maybe PT1 can help u out too. He is our english speaking mod. He has made his first steps in compiling in the same kind as u :wink:
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

Yes I understand - actually making some progress...

Have got the CVS and edited a file and saved to my linux desktop.
I tried

Code: Alles auswählen

cvs diff -pul  movieplayer.cpp movieplayer.cpp > movieplayer_diff.txt

I get a CVSROOT environment error? Searched Google and found to set

Code: Alles auswählen

export CVSROOT="/home/y/tuxbox/tuxbox-cvs"
Tried the first command again and get the following error

Code: Alles auswählen

cvs diff -pul  movieplayer.cpp movieplayer.cpp > movieplayer_diff.txt
cvs diff: cannot open CVS/Entries for reading: No such file or directory
cvs diff: I know nothing about movieplayer.cpp
The path to MP is

Code: Alles auswählen

/home/y/tuxbox/tuxbox-cvs/apps/tuxbox/neutrino/src/gui/movieplayer.cpp
I've managed a diff file using just diff but am unsure this is suitable or not.

movieplayer basic diff command:

Code: Alles auswählen

3023d3022
< 				
3027,3044c3026,3027
< 					//Hardcoded to test only; want a MP setting in conf- Jan08
< 					g_settings_streaming_allow_random == true;
< 					//Can I add a new MP Setting to the .conf file? - Jan08
< 					if (!g_settings_streaming_allow_random)
< 					{
< 						ctx->it++;
< 						if(ctx->it < ctx->lst_cnt)   ctx->itChanged = true;
< 						fprintf(stderr, "[mp] Playlist item? = [%d]\n", ctx->it );
< 					}
< 					else
< 					{
< 						//-- This will probably just play random files indefinitely with repeats until [Home key] to exit
< 						srand(time(0));
< 						// generates random number between 1 and lst_cnt - Jan08
< 						ctx->it = rand() % ctx->lst_cnt + 1;
< 						ctx->itChanged = true;
< 						fprintf(stderr, "[mp] Random playlist item? = [%d]\n", ctx->it );
< 					}
---
> 					ctx->it++;
> 					if(ctx->it < ctx->lst_cnt)	ctx->itChanged = true;
3047a3031
>
Help appreciated
ozbodd
Interessierter
Interessierter
Beiträge: 94
Registriert: Donnerstag 24. März 2005, 18:25

Re: Movieplayer random play & playlist

Beitrag von ozbodd »

Found Cervisia, a GUI CVS tool in the VM - Cool

Below is the diff - Still trying to find out how to make a neutrino though -@Tommy?

Code: Alles auswählen

Index: movieplayer.cpp
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/gui/movieplayer.cpp,v
retrieving revision 1.158
diff -U3 -r1.158 movieplayer.cpp
--- a/movieplayer.cpp	9 Dec 2007 23:30:53 -0000	1.158
+++ b/movieplayer.cpp	25 Jan 2008 23:08:22 -0000
@@ -1661,11 +1661,11 @@
   //-----------------------------------
   for(;;)
   {
-	if (isTerminated) return NULL;  // abort
-	
 	//-- check low level ... --  
 	if ( level < 2 )
-	{	
+	{
+		if (isTerminated) return NULL;  // abort
+	
 		//-- ... and freeze playback --
   		if (!freezed)
   		{
@@ -1681,6 +1681,8 @@
 	//-- in freezed state --
 	else if (freezed)
 	{
+		if (isTerminated) return NULL;  // abort
+
 		//-- wait for buffer filled or ... --
 		if ( level < nSegsOpt )
 		{
@@ -3020,15 +3022,31 @@
 			}
 			else
 			{
+				
 				//-- eventually activate autoplay for next file in a playlist --
 				if( (ctx->itChanged == false) && ctx->lst_cnt )
 				{
-					ctx->it++;
-					if(ctx->it < ctx->lst_cnt)	ctx->itChanged = true;
+					//Hardcoded to test only; want a MP setting in conf- Jan08
+					g_settings_streaming_allow_random == true;
+					//Can I add a new MP Setting to the .conf file? - Jan08
+					if (!g_settings_streaming_allow_random)
+					{
+						ctx->it++;
+						if(ctx->it < ctx->lst_cnt)   ctx->itChanged = true;
+						fprintf(stderr, "[mp] Playlist item? = [%d]\n", ctx->it );
+					}
+					else
+					{
+						//-- This will probably just play random files indefinitely with repeats until [Home key] to exit
+						srand(time(0));
+						// generates random number between 1 and lst_cnt - Jan08
+						ctx->it = rand() % ctx->lst_cnt + 1;
+						ctx->itChanged = true;
+						fprintf(stderr, "[mp] Random playlist item? = [%d]\n", ctx->it );
+					}
 				}
 				close(ctx->inFd);
 			}
-
 			ctx->inFd = -1;
 		}
 

@Seife - I have it including your patch
PT-1
Moderator english
Beiträge: 2458
Registriert: Donnerstag 20. Dezember 2001, 00:00

Re: Movieplayer random play & playlist

Beitrag von PT-1 »

make neutrino