Hellowlol / HTPC-Manager

A fully responsive interface to manage all your favorite software on your Htpc.
MIT License
344 stars 48 forks source link

Miscellaneous Questions #456

Open acharmedmatrix opened 8 years ago

acharmedmatrix commented 8 years ago

I am willing to modify the python and html pages, and have some experience with both languages, but I figured I would ask before fully tearing everything apart.

  1. Is there any way to make the Sonarr Calendar dashboard item default to week instead of day? This option does not seem to save in cookies so I have to change it every time I load the page.
  2. Is there an already existing SABnzbd currently downloading dashboard widget that I have not seen?
  3. Is there an already existing PlexPy dashboard widget? Or even just a way to put the Plex currently being watched on the dashboard?
  4. Is there a way to have my iframes show as actual tabs instead of an other dropdown?
  5. How can I change it so that the search bar always searches NZBs instead of filtering the current tab?
  6. Do dashboard widgets have their own files? Or are they just pulling from the standard module files?

Thanks for the time.

Regardless of your answers this is a fantastic fork that I find highly preferable to the original release.

Hellowlol commented 8 years ago

Hi! Thanks for the kind words :)

  1. Not atm, but if you does change this for yourself please send a pr.
  2. No, a pr would be accepted :P
  3. No, but it would have been cool :D
  4. Im not sure understand the question. If you enable iframes you clicking the header inside the modules makes the service open inside htpc manager image
  5. No, getting filter on all the tabs was a major pain, its like its held together with ducktape and gue, i aint touching it :P The hack job starts here: https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/default.js#L123 and https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/default.js#L99, you can try to comment out https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/default.js#L114
  6. No they dont, they pull from the modules.

Wow.. That alot of NOOOs. It sounds worse then it is. I pretty much accept any prs that extends the functionally to htpc manager (more config options), The only thing ill say blunt no to is the replace the filter option with nzbsearch. (this had to be configurable and with nzb disabled by default)

Happy hacking! Let me know if there are anything more i can help you with.

ps Here's a half written guide if you want to make a new module. https://github.com/Hellowlol/HTPC-Manager/wiki/How-to-make-your-own-module

acharmedmatrix commented 8 years ago

Appreciate the quick response. I already started tinkering with some smaller stuff so I'm sure I can get kicking with this stuff.

  1. Quick peek at this didn't turn up much but I was hoping you'd have some insight. I will dig deeper.

2 and 3. Definitely going to put some effort into developing these two.

  1. Those iframes are working great (even customized the stats one to open netdata). I mean if you add a custom application it creates a dropdown for "Other" I'd rather just have more tabs. Can screenshot later if need be.
  2. Appreciate the line references, I'll tinker around with that, but the new modules are higher priority for me.
  3. Alright cool. Could you point me to an example (perhaps Sabnzbd) of where the dashboard component is both laid out and called?

Will share anything I come up with. Thanks!

Sent from my iPhone

On Apr 15, 2016, at 8:25 PM, Hellowlol notifications@github.com wrote:

Hi! Thanks for the kind words :)

Not atm, but if you does change this for yourself please send a pr. No, a pr would be accepted :P No, but it would have been cool :D Im not sure understand the question. If you enable iframes you clicking the header inside the modules makes the service open inside htpc manager

No, getting filter on all the tabs was a major pain, its like its held together with ducktape and gue, i aint touching it :P The hack job starts here: https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/default.js#L123 and https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/default.js#L99, you can try to comment out https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/default.js#L114

No they dont, they pull from the modules.

Wow.. That alot of NOOOs. It sounds worse then it is. I pretty much accept any prs that extends the functionally to htpc manager (more config options), The only thing ill say blunt no to is the replace the filter option with nzbsearch. (this had to be configurable and with nzb disabled by default)

Happy hacking! Let me know if there are anything more i can help you with.

ps Here's a half written guide if you want to make a new module

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

acharmedmatrix commented 8 years ago

Sorry if this is unorganized, but I am just going to comment as I handle stuff so I don't forget anything.

For 1 (Sonarr calendar show whole week) a. Edit HTPC-Manager/interfaces/default/js/dash.js b. Right at the top of the file is defaultView: 'basicDay', c. Change this to either: defaultView: 'basicWeek', or defaultView: 'month', and it will default to week or month.

I'm sure this could pretty easily be done as an option just like other options, but I'm not really good enough with Python and JS to do it and honestly I know I want to keep week.

Hellowlol commented 8 years ago

The queue is being built in this function https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/sabnzbd.js#L238

acharmedmatrix commented 8 years ago

Funny I worked on this, this morning. I was able to get the queue on the dash without too much trouble. The issues I ran into were sizing the columns in the table and making it either constantly update or actively refresh.

On Apr 16, 2016, at 6:24 PM, Hellowlol notifications@github.com wrote:

The queue is being built in this function https://github.com/Hellowlol/HTPC-Manager/blob/master2/interfaces/default/js/sabnzbd.js#L238

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

acharmedmatrix commented 8 years ago

Still struggling to get the column sizing and the refresh thing figured out, please let me know if you have any thoughts...

Worked on number 4 today. Now that I looked through code maybe I can explain it better. Basically you have customurls going into an other dropdown, but I'd rather they just be normal tabs. I came up with a way to do it, but it is pretty specific to my setup because if you don't have enough customurls the site won't load. Nonetheless:

In base.html there is a section for customurls with two if statements, the first is if there is more than 1 which creates the dropdown, the second is for more than 0 (so exactly 1) which just creates an item. I just changed the >1 to >4 (I have three entries). Within the >0 is this statement: <li class="nav-menu-item other-link-item"><a href="${customurls[0]['url']|h, entity}" target="_blank">${customurls[0]['name']|h, entity}</a></li>

By adding: <li class="nav-menu-item other-link-item"><a href="${customurls[1]['url']|h, entity}" target="_blank">${customurls[1]['name']|h, entity}</a></li> <li class="nav-menu-item other-link-item"><a href="${customurls[2]['url']|h, entity}" target="_blank">${customurls[2]['name']|h, entity}</a></li>

I have made it so they show as three normal tabs instead of the other dropdown.

Again, not really sure of the best way for you to implement this in an actual release, or if you even care to. Just sharing what I figure out.

Hellowlol commented 8 years ago

I don't know where to look. If you push your code I'll take a look. I guess you don't use many services the . The problem with that method is that the menu top at will wrap when you to many items. I already needs to shorten the names so the menu don't wrap.

acharmedmatrix commented 8 years ago

Yeah I figured it was something like that, I also use 1920 or greater monitors so I have a lot of space, you have to worry about it working for everyone. I figured you wouldn't want to incorporate that, but I shared in case someone else wants to give it a whirl.

For the SAB thing... The issue I am running into is that even sized columns are being made which just looks silly AND cuts off the name. How did you make the status column small in the existing SAB module?

Hellowlol commented 8 years ago

I can't remember :p just right click and inspect Item in your browser. (On my phone now)

acharmedmatrix commented 8 years ago

Fair enough, I'll figure it out.

Another thing... Any idea on a way of how to compare the current time to the air time so that the Sonarr calendar can have a third color for shows that have not aired yet?

acharmedmatrix commented 8 years ago

Not sure if this is the best way to do it (first time posting on git). Nearly perfect (for my liking) SABnzbd queue dashboard module:

Modifications to dash.js:

function loadActiveDownloads() {
  function ActiveDownloadsLoop(){
  if (!$('#activedownloads_table_body').length) return
  $('#activedownloads_table_body').empty()
  $.getJSON(WEBDIR + 'sabnzbd/GetStatus', function(data) {
      if(data.queue.status == 'Idle'){
          $('#dash_sabnzbd2').children('h3:first-child').empty().append(('<a href="sabnzbd/#active">Queue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>' + 'Idle&nbsp;'))
      }
      if(data.queue.status == 'Paused'){
          $('#dash_sabnzbd2').children('h3:first-child').empty().append(('<a href="sabnzbd/#active">Queue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>' + 'Paused:&nbsp;' + '<button onclick="nzb_play_button()" class="btn" id="nzb_play_button"><i class="fa fa-play"></i></button>'))
      }
          if(data.queue.status == 'Downloading'){
          $('#dash_sabnzbd2').children('h3:first-child').empty().append(('<a href="sabnzbd/#active">Queue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Speed:&nbsp;</a>' + data.queue.speed + 'B/Sec' + '<button onclick="nzb_pause_button()" class="btn" id="nzb_pause_button"><i class="fa fa-pause"></i></button>'))
      }
          $.each(data.queue.slots, function(i, slot) {
          $('#activedownloads_table_body').append(
          $('<tr>').append(
              $('<td>').html(slot.filename).attr('title', slot.filename),
              $('<td>').html(slot.sizeleft).attr('title', slot.sizeleft),
              $('<td>').html(slot.timeleft).attr('title', slot.timeleft),
              $('<td>').html('<button onclick="nzb_delete_button(\''+slot.nzo_id+'\')" class="btn" id="nzb_delete_button"><i class="fa fa-minus"></i></button>')
        )
  )})
  })
  }
  ActiveDownloadsLoop();
  setInterval(ActiveDownloadsLoop,1000);
}
function nzb_pause_button(){
    var clickItem = $(this);
        clickItem.button('loading');
$.ajax({
            url: WEBDIR + 'sabnzbd/TogglePause?mode=pause',
            dataType: 'json',
            type: 'get'
        });
}
function nzb_play_button(){
    var clickItem = $(this);
        clickItem.button('loading');
$.ajax({
            url: WEBDIR + 'sabnzbd/TogglePause?mode=resume',
            dataType: 'json',
            type: 'get'
        });
}
function nzb_delete_button(id){
if (confirm('Are you sure?')) {
        $.ajax({
            url: WEBDIR + 'sabnzbd/DeleteNzb?id=' + id,
            type: 'get',
            dataType: 'json',
});
}
}

I'm sure you could figure out a better way to do the spacing here, but the blankspaces work. Could also probably make a single toggle function instead of pause and play. My biggest gripe with this is that the refresh noticeably flashes, whereas the built in SAB module does not seem to do that.

Modifications to dash.html:

%if settings.get('dash_sabnzbd2', 0):
            <div class="span4 dash-module" id="dash_sabnzbd2">
                <h3><a href="sabnzbd/#active">Queue</a></h3>
                <table class="table table-striped table-main">
                    <thead>
                        <tr>
                            <th>File</th>
                            <th>Size Left</th>
                            <th>Time Left</th>
                            <th>Remove</th>
                        </tr>
                    </thead>
                    <tbody id="activedownloads_table_body"></tbody>
                </table>
            </div>
        %endif

Modifications to dash.css:

.dashboard .span4 #activedownloads_table_body td:first-child {
    width: 380px;
}
.dashboard .span4 #activedownloads_table_body td:nth-child(2) {
   text-align:right;
}
.dashboard .span4 #activedownloads_table_body td:nth-child(3) {
   text-align:right;
}
.dashboard .span4 #activedownloads_table_body td:last-child {
   text-align:right;
}

Description:

Label says Queue and contains link to the queue section. When idle it simply says Idle on the right side of the header row. When downloading "idle" becomes "Speed: XX B/Sec" and a pause button. If paused the "Idle" becomes "Paused:" with a play button. The pause and play buttons switch between play and pause. Each individual item displays the file name, how much is left (in bytes), remaining time, and a minus button which will pop up an "Are you sure" dialog which will delete the NZB if you choose "OK."

The entire module refreshes every second which, like I said, is my biggest gripe, the refresh noticeably flashes, whereas the built in SAB module does not seem to do that.

Let me know if you have any thoughts, questions, or anything. Thanks!

Edit: Just realized I forgot to mention, you also need to add a new entry to settings.html

{'type':'bool', 'label':'Show SABnzbd Queue', 'name':'dash_sabnzbd2',
         'checked':bool(settings.get('dash_sabnzbd2', 0))},
acharmedmatrix commented 8 years ago

Sorry if I am bombarding you.... Worked on Sonarr calendar a bit... Now it has some of the functionality of the actual interface (blue if unaired, red if missing and aired, green if you have it).

Modifications made in base.css:

.calendar_unaired {
  border-color: #4f90d9;
  background-color: #4f90d9;
}

Modifications made in sonarr.js Change

          if(event.all.hasFile){
        element.addClass('calendar_has_file');
      } else {
        element.addClass('calendar_missing_file');
      }

To:

var time = new Date();

      if (Date.parse(event.all.airDateUtc) < time) {
          if(event.all.hasFile){
        element.addClass('calendar_has_file');
      } else {
        element.addClass('calendar_missing_file');
      }
      }
      else{
          element.addClass('calendar_unaired');
      }

Same changes to dash.js to do it on the dash module.

I don't think I have any questions on that one, but let me know if you have any thoughts on it.

Hellowlol commented 8 years ago

When I said push I meant forked the project, make a branch and push that to GitHub, I guess this works too :p I'll add it to a branch so I can try to figure out the flashing. Might take some time as I'm swamped the entire week.

acharmedmatrix commented 8 years ago

All good, it's on my version now so I'm satisfied. No idea on the Plex thing, though. I'll have to come back to it. Seems like you laid the groundwork with WEBDIR + plex/NowPlaying though. Just couldn't figure out a good way to use that information. I think I might be able to rewrite it as a table, but I was trying to make it work as a carousel.

Hellowlol commented 8 years ago

You should really make a branch on github so you can easily merge your changes when htpc manager is updated. If not you have to do this manually on each update :)

acharmedmatrix commented 8 years ago

Guess I should learn how to make a branch then...

On Apr 18, 2016, at 4:54 AM, Hellowlol notifications@github.com wrote:

You should really make a branch on github so you can easily merge your changes when htpc manager is updated. If not you have to do this manually on each update :)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

acharmedmatrix commented 8 years ago

FYI I'm editing my stuff into the settings instead of being hardcoded and then I'll make a branch. So by all means look over my stuff if you have ideas, but just know I'm still working on it.

On Apr 18, 2016, at 4:54 AM, Hellowlol notifications@github.com wrote:

You should really make a branch on github so you can easily merge your changes when htpc manager is updated. If not you have to do this manually on each update :)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

Hellowlol commented 8 years ago

Alright. I'm to lazy to add this manually so I'll test it when you push a branch