Results 1 to 5 of 5

Thread: Automation of At-Large

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default Automation of At-Large

    Hi there,

    I just noticed this post https://forum.applian.com//showthread.php?t=856 requesting a simple command-line interface for the automation of recordings, maybe for scripting purposes. I can't emphasise how useful this would be, and personally I was quite surprised when I discovered this wasn't supported to begin with.

    As a bit of background, I intend to write a plugin for an application called TV-Browser. TV-Browser is an EPG (Electronic Program Guide) Application which allows you to download TV listings for your area to your PC. I aim to integrate this with At-Large to make it much easier to record programs, simply by selecting them, much as you might with a Tivo or similar.

    At the moment, it seems that it might be possible to automate At-Large using the .ini files, but I haven't thoroughly checked it out yet.

    If there is an undocumented command-line interface, or any other commonly used methods of automating At-Large, I'd very much like to know.

    Of course, once I have completed the plug-in, I will share it here

  2. #2
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default Re: Automation of At-Large

    Ok, as I expected, nobody from Applian either knows or cares about this kind of thing. I thought I'd share what I've found out so far, just in case anyone is actually interested.

    There doesn't seem to be any way of automating recordings at all built into the At-Large Recorder. There aren't any command-line options as far as I can see, or anything else, having run the app through a debugger.

    The app itself does pick up recording pre-sets from the rconfigs.ini file. Unfortunately, you still have to manually select these presets once At-Large is launched. What I'm effectively saying here is that you have to manually click buttons to get it to record.

    Whilst At-Large was a good little app before the capture of Sling streams was a widespread ability, it seems there are now much cheaper (read free) alternatives which one might be able to integrate with an EPG, so I think I'll be concentrating my efforts on those. If anyone does want details, please feel free to send me a message on the forum.

  3. #3
    Join Date
    Aug 2010
    Posts
    3
    Rep Power
    0

    Default Re: Automation of At-Large

    I have done in the way the_prof mentioned, and am using this always to record from iEPG which is Japanese standard online EPG information.
    It is basically text string processing to add the entry [iEPG] in rconfigs.ini. [iEPG] selection will appear where usually you only see [Last Used] in "Setup Recording" window. You still need clicks to select this, but I no longer need to enter time, channel, and etc manually.
    I know you will not record Japanese programs, the code might be useful as your starting point. I hope nobody complains me on pasting my ugly code here.

    Code:
    #include <stdio.h>
    #include <string.h>
    
    #define	DEBUG	0
    
    typedef struct
    {
        int		year;
        int		month;
        int		day;
        int		start_hour;
        int		start_min;
        int		ampm;
        int		weekday;
        int		duration;
        int		channel;
    } info_t;
    
    typedef struct
    {
    	char	*name;
    	int		ch;
    } ch_t;
    
    ch_t ch_list[]=
    {
    	{"NHK総合", 1},
    	{"NHK教育", 3},
    	{"日本テレビ", 14},
    	{"TBS", 16},
    	{"フジテレビ", 18},
    	{"テレビ朝日", 20},
    	{"テレビ東京", 22},
    	{"MXテレビ", 5},
    	{"放送大学", 67},
    	{"NHK衛星第一", 8},
    	{"NHK衛星第二", 9}
    };
    
    #define	MAX	100
    
    // years ending with 00 have to be divisible by 400 to leap
    // note the "&&" is a DaniWeb problem and should be a double & for AND
    #define isleapyear(year) ((!(year % 4) && (year % 100)) || (!(year % 400) && (year % 1000)))
    
    //
    // return 1 if date is valid, 0 otherwise.
    //
    int isdatevalid(int month, int day, int year)
    {
    	if (day <= 0) return 0 ;
    	switch( month )
    	{
    		case 1 :
    		case 3 :
    		case 5 :
    		case 7 :
    		case 8 :
    		case 10 :
    		case 12 :
    			if (day > 31) return 0 ; else return 1 ;
    		case 4 :
    		case 6 :
    		case 9 :
    		case 11 :
    			if (day > 30) return 0 ; else return 1 ;
    		case 2 :
    			if ( day > 29 ) return 0 ;
    			if ( day < 29 ) return 1 ;
    			if (isleapyear(year)) return 1 ; // leap year
    			else return 0 ;
    	}
    	return 0 ;
    }
     
    //
    // given month, day, year, returns day of week, eg. Monday = 0 etc.
    // tested for 1901 to 2099 (seems to work from 1800 on too)
    //
    int weekday(int month, int day, int year)
    {
    	int ix, tx, vx;
    	 
    	switch (month) {
    		case 2 :
    		case 6 :
    			vx = 0; break;
    		case 8 : 
    			vx = 4; break;
    		case 10 : 
    			vx = 8; break;
    		case 9 :
    		case 12 : 
    			vx = 12; break;
    		case 3 :
    		case 11 : 
    			vx = 16; break;
    		case 1 :
    		case 5 : 
    			vx = 20; break;
    		case 4 :
    		case 7 : 
    			vx = 24; break;
    	}
    	if (year > 1900) // 1900 was not a leap year
    		year -= 1900;
    		ix = ((year - 21) % 28) + vx + (month > 2); // take care of February
    		tx = (ix + (ix / 4)) % 7 + day; // take care of leap year
    	return (tx % 7);
    }
    
    int parse_tvpi( FILE *fi, char *buf, info_t *info )
    {
    	char	work[50];
    	int		i, ret = 0;
    	int		pos, start, end;
    	char	*pos_ptr;
    	
    	while( fgets(buf, MAX, fi) != NULL )
    	{
    		
    		if( (pos_ptr = strchr( buf, (int)':')) == NULL )
    			continue;
    		pos = (int)(pos_ptr - buf);
    
    		for( i = 0; i < pos; i++ )
    			work[i] = buf[i];
    		work[i] = 0;
    		
    		if( strcmp( work, "year") == 0 )
    			info->year = atoi( buf + pos + 1 );
    		else if( strcmp( work, "date") == 0 )
    			info->day = atoi( buf + pos + 1 );
    		else if( strcmp( work, "month") == 0 )
    			info->month = atoi( buf + pos + 1 );
    		else if( strcmp( work, "start") == 0 )
    		{
    			info->start_hour = atoi( buf + pos + 2 );
    			info->start_min = atoi( buf + pos + 5 );
    			start = info->start_hour * 60 + info->start_min;
    			if( info->start_hour > 11 )
    				info->ampm = 1;
    			else
    				info->ampm = 0;
    			if( info->start_hour > 12 )
    				info->start_hour -= 12;
    		}
    		else if( strcmp( work, "end") == 0 )
    		{
    			end = atoi( buf + pos + 2 ) * 60 + atoi( buf + pos + 5 );
    		}
    		else if( strcmp( work, "station") == 0 )
    		{
    			for( i = 0; i < sizeof(ch_list)/sizeof(ch_t); i++ )
    			{
    				if( strncmp( buf + pos + 2, ch_list[i].name, strlen(ch_list[i].name)) == 0 )
    					info->channel = ch_list[i].ch;
    			}
    #if !DEBUG
    			if( info->channel == 0 )
    #endif
    			{
    				printf("%s\n", buf);
    			}
    		}
    	}
    
    	if( info->channel == 0 )
    	{
    		ret = -1;
    		goto bail2;
    	}
    	if( isdatevalid( info->month, info->day, info->year ) == 0 )
    	{
    		ret = -1;
    		goto bail2;
    	}
    	else
    		info->weekday = (weekday( info->month, info->day, info->year ) + 1) % 7;
    
    	if( end > start )
    		info->duration = end - start;
    	else
    		info->duration = end + 24*60 - start;
    bail2:	
    	return ret;
    }
    
    int main(int argc, char* argv[])
    {
    	FILE	*fi, *fo;
    	char	buf[MAX], saveto[MAX];
    	int		i, val1, val2, val3, ret, found = 0;
    	info_t	info;
    
    	for( i = 0; i < sizeof(info_t); i++ )
    		*((char *)(&info) + i) = 0;
    
    	if( (fi = fopen("\\progra~1\\AT-LAR~1\\rconfigs.ini", "r")) == NULL )
    	{
    		printf("input file open failed\n");
    		ret = -1;
    		goto bail;
    	}
    	if( (fo = fopen("\\progra~1\\AT-LAR~1\\rconfigs.tmp", "w")) == NULL )
    	{
    		printf("output file open failed\n");
    		ret = -1;
    		goto bail;
    	}
    
    	while( fgets(buf, MAX, fi) != NULL )
    	{
    		val1 = strncmp( buf, "[", 1 );
    		val2 = strncmp( buf, "[iEPG]", 6 );
    		val3 = strncmp( buf, "[LAST_USED", 10 );
    		if( val2 == 0 )
    			found = 1;
    		else if( val3 == 0 )
    			found = 2;
    		else if( val1 == 0 )
    			found = 0;
    
    		if( found != 1 )
    			fputs(buf, fo);
    		if( (found == 2) && (strncmp(buf, "SaveToDir", 9) == 0) )
    		{
    			strncpy( saveto, buf, strlen(buf) );
    			saveto[strlen(buf)+1] = 0;
    		}
    	}
    	fclose( fi );
    	fclose( fo );
    
    	if( (fi = fopen("\\progra~1\\AT-LAR~1\\rconfigs.tmp", "r")) == NULL )
    	{
    		printf("input file open failed\n");
    		ret = -1;
    		goto bail;
    	}
    	if( (fo = fopen("\\progra~1\\AT-LAR~1\\rconfigs.ini", "w")) == NULL )
    	{
    		printf("output file open failed\n");
    		ret = -1;
    		goto bail;
    	}
    
    	while( fgets(buf, MAX, fi) != NULL )
    		fputs(buf, fo);
    
    	fclose( fi );
    
    	if( (fi = fopen( argv[1], "r")) == NULL )
    	{
    		printf("input file open failed\n");
    		ret = -1;
    		goto bail;
    	}
    
    	if( (ret = parse_tvpi( fi, buf, &info ) ) != 0 )
    	{
    		printf("tvpi parse failed\n");
    		ret = -1;
    		goto bail;
    	}
    	
    	fprintf( fo, "[iEPG]\n" );
    	fprintf( fo, saveto );
    	fprintf( fo, "Time=%02d:%02d %s\n", info.start_hour, info.start_min, (info.ampm == 0)? "AM":"PM");
    	fprintf( fo, "Channel=%d\n", info.channel);
    	fprintf( fo, "Day=%d\n", info.weekday);
    	fprintf( fo, "StartNow=0\n");
    	fprintf( fo, "Repeat=0\n");
    	fprintf( fo, "DurationValue=%d\n", info.duration);
    	fprintf( fo, "RepeatTimes=1\n");
    	fprintf( fo, "DurationType=0\n");
    	fprintf( fo, "Use=0\n");
    	fprintf( fo, "VideoSize=1\n");
    	fprintf( fo, "UseVideoOutput=0\n");
    	fprintf( fo, "VideoBitrate=300\n");
    	fprintf( fo, "FrameRate=30\n");
    	fprintf( fo, "VideoSmoothness=50\n");
    	fprintf( fo, "AudioBitrate=32\n");
    	fprintf( fo, "IFrame=15\n");
    	
    	fclose( fi );
    	fclose( fo );
    
    bail:	
    #if !DEBUG
    	if( ret != 0 )
    #endif
    	{
    		printf("Hit ENTER to exit");
    		gets( buf );
    	}
    	return ret;
    }

  4. #4
    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Default Re: Automation of At-Large

    Quote Originally Posted by the_prof View Post
    Ok, as I expected, nobody from Applian either knows or cares about this kind of thing. I thought I'd share what I've found out so far, just in case anyone is actually interested.

    There doesn't seem to be any way of automating recordings at all built into the At-Large Recorder. There aren't any command-line options as far as I can see, or anything else, having run the app through a debugger.

    The app itself does pick up recording pre-sets from the rconfigs.ini file. Unfortunately, you still have to manually select these presets once At-Large is launched. What I'm effectively saying here is that you have to manually click buttons to get it to record.

    Whilst At-Large was a good little app before the capture of Sling streams was a widespread ability, it seems there are now much cheaper (read free) alternatives which one might be able to integrate with an EPG, so I think I'll be concentrating my efforts on those. If anyone does want details, please feel free to send me a message on the forum.
    Hi the_prof

    I'm very interested in getting a command line tool that I can use with a remote to start and stop a recording.

    Can you let me know what you have found please?

    Thanks a lot!

    Dom

  5. #5
    Join Date
    Aug 2010
    Posts
    3
    Rep Power
    0

    Default Re: Automation of At-Large

    I have automated using mouse movement recorder. The one that I am using is script base, so pretty flexible.
    The EPG file is opened by a batch file, and the batch file does following:
    1. Convert the EPG information to what At-large can understand using the program that i have posted previously
    2. Start the At-large
    3. replay the mouse movement. This selects the converted information and start record with that.

    I have used uwsc to record/replay the mouse move, but other program should be able to the same.
    http://www.uwsc.info/sample.html

Similar Threads

  1. At-Large support for Pro-HD slingbox
    By nuke12 in forum At-Large Recorder
    Replies: 2
    Last Post: 02-19-2009, 03:33 AM
  2. Can I use At-Large to record from a DVR?
    By lokar in forum At-Large Recorder
    Replies: 1
    Last Post: 02-03-2009, 04:22 PM
  3. mpeg2=very large files
    By muskrat897 in forum Replay Video Capture
    Replies: 1
    Last Post: 12-29-2008, 09:13 PM
  4. Can At-Large record to formats aside from ASF?
    By nonchalant in forum At-Large Recorder
    Replies: 2
    Last Post: 10-15-2008, 10:24 AM
  5. Update At-Large Help File
    By floydj in forum At-Large Recorder
    Replies: 3
    Last Post: 03-19-2008, 07:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About these forums...
Applian Technologies makes these discussion forums available for our customers to assist other users. We do read this content and appreciate all your suggestions and comments. If you need technical support or customer service, please visit the links to the right.
Let's Be Friends