Hi all,
By default, when a Transmission web interface session is loaded on a browser for the first time the web interface's page refresh rate defaults to 5 seconds.
How is this default page refresh rate defined for transmission-daemon? Can I modify this preset? A line item in the settings.json maybe?
Thanks,
Reactor89
Default page refresh setting - Web interface
Re: Default page refresh setting - Web interface
It looks like that constant is defined in web/javascript/transmission.js:
Code: Select all
rolcol@laptop:~/Desktop/Transmission/web$ grep -rni "refreshrate" . | grep -v ".svn"
./javascript/transmission.js:642: if( rate != tr[Prefs._RefreshRate] ) {
./javascript/transmission.js:643: tr.setPref( Prefs._RefreshRate, rate );
./javascript/transmission.js:829: if( !this[Prefs._RefreshRate] )
./javascript/transmission.js:830: this[Prefs._RefreshRate] = 5;
./javascript/transmission.js:832: this._periodic_refresh = setInterval(function(){ tr.refreshTorrents(); }, this[Prefs._RefreshRate] * 1000 );
./javascript/transmission.js:861: if( !this[Prefs._RefreshRate] ) this[Prefs._RefreshRate] = 5;
./javascript/transmission.js:862: this._metadata_refresh = setInterval(function(){ tr.refreshTorrents(ids); }, this[Prefs._RefreshRate] * 1000 );
./javascript/transmission.js:878: if( !this[Prefs._SessionRefreshRate] )
./javascript/transmission.js:879: this[Prefs._SessionRefreshRate] = 5;
./javascript/transmission.js:882: function(){ tr.loadDaemonPrefs(); }, this[Prefs._SessionRefreshRate] * 1000
./javascript/transmission.js:897: if( !this[Prefs._SessionRefreshRate] )
./javascript/transmission.js:898: this[Prefs._SessionRefreshRate] = 5;
./javascript/transmission.js:901: function(){ tr.loadDaemonStats(); }, this[Prefs._SessionRefreshRate] * 1000
./javascript/transmission.js:1001: $('input#refresh_rate')[0].value = prefs[Prefs._RefreshRate];
./javascript/common.js:213:Prefs._RefreshRate = 'refresh_rate';
./javascript/common.js:214:Prefs._SessionRefreshRate = 'session_refresh_rate';
Re: Default page refresh setting - Web interface
Hmmm..... it's interesting that the default refresh rate seems to be controlled by explicit integers on multiple lines of code and not with a global variable. It wouldn't be hard to customize the javascript to control the default refresh rate but I would need to redo the code every time wanted to upgrade transmission. In many ways this one step forward and two steps back.
If modifying the transmission web interface's code is truly my only option, how might I suggest to the transmission developers that they may want to add a line to the settings.json that controls the default refresh rate for webui sessions?
Reactor89
If modifying the transmission web interface's code is truly my only option, how might I suggest to the transmission developers that they may want to add a line to the settings.json that controls the default refresh rate for webui sessions?
Reactor89
Re: Default page refresh setting - Web interface
Have you used the Preferences setting of this variable?
If that doesn't work, then open a bug report.
If that doesn't work, then open a bug report.
Re: Default page refresh setting - Web interface
rb07 wrote:Have you used the Preferences setting of this variable?

If the circled setting in the image above is the "Preferences setting" you're describing my answer is yes, this setting does work.
The catch is the setting is "session specific". Put another way, the value that a user inputs for this setting is saved to cache on local machines and not the machine hosting the transmission web interface itself. Every time the transmission web interface is loaded by an environment (web browser/computer) that doesn't have the user defined refresh rate saved to cache (i.e. the webui is being loaded for the first time or cache is cleared) the refresh rate defaults to 5 seconds and the user has to change the setting again to their liking.
I'm looking for away to control this refresh setting from within transmission itself so the refresh rate defaults to a value I like when ever a new web interface session is started.
Yet as Rolcol points out, this setting seems to be hard coded into the javascript of the transmission web interface in multiple places. In my opinion, hard coding integers into a program is bad practice. The rational being that variables can be documented as corresponding to certain aspects of a program, the integer 5 could control any number of items in program and demand that programmers have a high level understanding of the code and a reliable understanding of the integer in its context before modifying the integer.
This being said, it's my recommendation to the transmission development team to have the web interface refresh rate controlled by a variable within a settings file of the transmission code base. This would both create the functionality I'm looking for and be better programming practice overall.
Reactor89
Re: Default page refresh setting - Web interface
x190, I give you a virtual high five! 
The refresh_rate variable in the common.js seems to be the default refresh value for transmission's web interface and it worked for me!
Follow-up Question: Will the common.js be over written the next time I upgrade the transmission software.
Reactor89

The refresh_rate variable in the common.js seems to be the default refresh value for transmission's web interface and it worked for me!
Follow-up Question: Will the common.js be over written the next time I upgrade the transmission software.
Reactor89