Bravo List
Register
Go Back   > Bravo List > Source Code > Trackers > TBDev
Reply
  #1  
Old 24-05-19, 22:21
elvira's Avatar
elvira elvira is offline
Senior Member
 
Join Date: Jan 2008
Slovenia
Posts: 112
Default seeders colors in browse
hey,

how can I use seeders colors in browse like this one

Click the image to open in full size.
Reply With Quote
  #2  
Old 25-05-19, 00:11
Napon's Avatar
Napon Napon is offline
Senior Member
 
Join Date: Feb 2016
P2P
Posts: 390
Default
ive got this
Reply With Quote
  #3  
Old 25-05-19, 08:32
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 51
Default
I don't check whether the torrent is being seeded, but whether the torrent has been snatched. You can change this easily enough to peers if desired. In my opinion what the user wants to know is if they have snatched that particular torrent before, sometimes its difficult to remember.

I can't give you an exact change to your query, since you haven't posted it. But, what I do in my code is add a left join to the snatched column and then a select from that like this
Code:
LEFT JOIN snatched AS s on s.torrentid = t.id AND s.userid = $CURUSER['id']
and the select
Code:
IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go
Please escape the $CURUSER['id'] however your code does it.
Now you have the coloumn to_go available.
When you loop through the query to display the data, if to_go == -1 then the user has not snatched the torrent. If to_go = 100 then the have completed the torrent and if its anything else, then they have snatched it but not completed it. Then you simply adjust the color of the seeders to match what you want to show.

In my code, I have a column specifically for completed/snatched but I also use FluentPDO in that query and its a searchable column This is that portion of my query.
Code:
if (isset($_GET['unsnatched']) && $_GET['unsnatched'] == 1) {
    $count = $count->where('s.to_go IS NULL')
                   ->leftJoin('snatched AS s on s.torrentid = t.id AND s.userid = ?', $CURUSER['id']);
    $select = $select->select('IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go')
                     ->leftJoin('snatched AS s on s.torrentid = t.id AND s.userid = ?', $CURUSER['id'])
                     ->having('to_go = -1');
    $addparam .= 'unsnatched=1&';
} else {
    $select = $select->select('IF(s.to_go IS NOT NULL, (t.size - s.to_go) / t.size, -1) AS to_go')
                     ->leftJoin('snatched AS s on s.torrentid = t.id AND s.userid = ?', $CURUSER['id']);
}
I hope that can get something useful from this.
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.
Reply With Quote
The Following User Says Thank You to darkalchemy For This Useful Post:
papad (26-05-19)
  #4  
Old 26-05-19, 11:25
Napon's Avatar
Napon Napon is offline
Senior Member
 
Join Date: Feb 2016
P2P
Posts: 390
Default
what about get ratio colur will do this not the above pm me ill give you the code for it
__________________
https://uploadfiles.io/lgekz
Reply With Quote
  #5  
Old 26-05-19, 15:25
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 51
Default
Sure that would work, if you new what the ratio is. But, where do you get the ratio from? You just make it up or do you add a new query for each torrent, like I have seen a dozen times in code.

Please show your code, don't be afraid to show your awesomeness and show us want to be coders just how we are doing things the wrong way. I would gladly thank you profusely if you could just show me the error in my code.

Bump: My code actually shows whether the user has snatched the torrent.
Click the image to open in full size.
and it only uses 2 queries to get the data.
Click the image to open in full size.
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.
Reply With Quote
The Following User Says Thank You to darkalchemy For This Useful Post:
Fynnon (26-05-19)
  #6  
Old 26-05-19, 22:33
Napon's Avatar
Napon Napon is offline
Senior Member
 
Join Date: Feb 2016
P2P
Posts: 390
Default
i do not thanks u do your way andd ill do it my way/with mysqli too
__________________
https://uploadfiles.io/lgekz
Reply With Quote
  #7  
Old 26-05-19, 23:41
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 51
Default
so....
you're saying you can't show me where my code is wrong?

What about showing us how you did it? So we can all learn from you.

If I said please, pretty please, would you show us? We have so much to learn.

Bump: Actually, don't worry about showing us your code, because we all know its not in your code. I've looked at your code. Napon's Code
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.

Last edited by darkalchemy; 26-05-19 at 23:53.
Reply With Quote
  #8  
Old 27-05-19, 19:38
Napon's Avatar
Napon Napon is offline
Senior Member
 
Join Date: Feb 2016
P2P
Posts: 390
Default
what did i tell you REMOVE THAT FROM YOUR GIT HUB...as that code as been updated with new code chap so your leaving old code on there thats no good to no one but did you listen NO NO NO NO

Just a side Note i do have this mod of seeders colors in browse too not hard to code your a coder so u should know how its not so hard is it...without the above you have done in codebox
__________________
https://uploadfiles.io/lgekz
Reply With Quote
  #9  
Old 27-05-19, 23:40
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 51
Default
hahahahahahahaha

you're an idiot
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.
Reply With Quote
  #10  
Old 28-05-19, 18:50
Napon's Avatar
Napon Napon is offline
Senior Member
 
Join Date: Feb 2016
P2P
Posts: 390
Default
could say the same as you...... you're an idiot big time
Attached Thumbnails
Screenshot_2019-05-28 FMEDition net Torrants.png  
__________________
https://uploadfiles.io/lgekz
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 13:37. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2019, vBulletin Solutions Inc.