GIMP Chat
http://gimpchat.com/

Proposal: a "View Topics in order of views"
http://gimpchat.com/viewtopic.php?f=15&t=20711
Page 1 of 2

Author:  dinasset [ Fri Jan 12, 2024 5:20 am ]
Post subject:  Proposal: a "View Topics in order of views"

Just an idea:

it could be interesting to have (it not yet available, IDK) an option to ask for getting the list of all topics in order of views received.

Author:  trandoductin [ Fri Jan 12, 2024 9:41 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

I don't think there is a way right now on gc. it's like ancient phpbb I think.
So with the help of chatGPT I thought I would share a snapshot taken minutes ago here:
Active Topics listed by Decending Views Snapshot Jan 12, 2024

If you're interested in running the snapshot again at a later time. here's the python code (It takes about 7 minutes to run with 744 pages of pages which you can change number of pages and stuff in the loop)
I named it "gc.py"
import requests
from bs4 import BeautifulSoup

def get_page_source(url):
    response = requests.get(url)
    if response.status_code == 200:
        return response.text
    else:
        print(f"Failed to retrieve page. Status code: {response.status_code}")
        return None

def parse_table_rows(html_content):
    soup = BeautifulSoup(html_content, 'html.parser')
    table = soup.find_all('table', {'class': 'tablebg'})

    if len(table) > 1:  # Check if there is a second table with the class 'tablebg'
        second_table = table[1]
        rows = second_table.find_all('tr')

        data_array = []
        for row in rows[1:25]:  # Skip the first row as headers
            #print (str(row))
            columns = row.find_all(['td', 'th'])
            row_data = [column.get_text(strip=True) for column in columns]

            # Check if the third column is a link
            if len(columns)>=3:
                link_td = columns[2]
                link = link_td.find('a')
                if link:
                    href_value = link.get('href')
                    row_data.append(href_value)
                data_array.append(row_data)   
           
        return data_array

    else:
        print("Second table not found.")
        return None
    #print (html_content)
    # table = soup.find('table', {'class': 'tablebg'})
   
    # if table:
    #     rows = table.find_all('tr')
    #     for row in rows:
    #         columns = row.find_all(['td', 'th'])
    #         for column in columns:
    #             print(column.get_text(strip=True), end='\t')
    #         print()

if __name__ == "__main__":
    arrs = []
    for p in range(0,745):
        url = "http://gimpchat.com/search.php?st=0&sk=t&sd=d&sr=topics&search_id=active_topics&start=" + str(p*25)
        page_source = get_page_source(url)
        if page_source:
            arr = parse_table_rows(page_source)
            arrs = arrs + arr
            # for i in range(0,len(arr)):
            #     print ("<a href='" + str(arr[7])+ "'>" + str(arr[2]))

    sorted_array = sorted(arrs, key=lambda x: - int(x[5]))
    arr = sorted_array
    print ("<table><tr><td>No.</td><td>Topic</td><td>Author</td><td>Views</td></tr>")
    for i in range(0,len(arr)):
        row = arr[i]
        try:
            print ("<tr><td>"+str(i+1)+"</td><td><a href='http://gimpchat.com/" + str(row[7])+ "'>" + str(row[2]) + "</a></td><td>"+str(row[3])+"</td><td>"+str(row[5])+"</td></tr>")
        except UnicodeEncodeError as e:
            continue     


And I run it with the below command to output it to test1.html which can then be opened with browser
python gc.py > test1.html

Author:  dinasset [ Fri Jan 12, 2024 9:58 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

Wow.
Is it possible to extend the .py capability in order to do the list by topic groups?
like:
- Gimp Art
- Gimp Scripts and Plug-ins
- etc
to get a shorter list?

Author:  trandoductin [ Fri Jan 12, 2024 10:04 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

I'll see what I can do. :D

Author:  Skinnyhouse [ Fri Jan 12, 2024 10:07 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

If I remember right Tim did some really interesting stuff in a similar way back over on GimpLearn for viewing custom fonts - but of course that was with recent web technology. But very useful.

Author:  dinasset [ Fri Jan 12, 2024 10:09 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

If I download it as .pdf I get it but truncated horizontally; what can I set while saving to reduce maybe the characters dimension?

well, it can be saved as html, but if it could be produced with a bit smaller character size I think that also in pdf would be readable completely.

Author:  trandoductin [ Fri Jan 12, 2024 11:18 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

what are you trying to do as pdf? my snapshot?

Author:  dinasset [ Fri Jan 12, 2024 11:28 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

Yes

Author:  dinasset [ Fri Jan 12, 2024 11:37 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

Once downloaded as .pdf, you can see pages large as this one (only a small amount of the right part is lost)
Attachment:
OnePage of pdf.PNG
OnePage of pdf.PNG [ 139.2 KiB | Viewed 607 times ]

Author:  trandoductin [ Fri Jan 12, 2024 11:39 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

it fits fine if you choose "Print" then as PDF instead of saving as PDF
I can't attach it because it's bigger than 6MiB

Author:  trandoductin [ Fri Jan 12, 2024 11:40 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

here's snapshot broken down into their groups.
It's too large to be clickable link but it's there so you can text search by GROUPNAME:followed by groupname with no prepended space.
https://tinmantaken.blogspot.com/2024/0 ... roups.html

Author:  dinasset [ Fri Jan 12, 2024 11:45 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

trandoductin wrote:
it fits fine if you choose "Print" then as PDF instead of saving as PDF
I can't attach it because it's bigger than 6MiB

it's what I did, just repeated and it fits as shown (losing part of the right side

Author:  dinasset [ Fri Jan 12, 2024 11:51 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

The same happens with the new snapshop, maybe you created it with a width larger than 132?

Author:  dinasset [ Fri Jan 12, 2024 11:57 am ]
Post subject:  Re: Proposal: a "View Topics in order of views"

Also, the search seems not to work, it indicates the search entered on top but the detail is not

Attachments:
Search not done (only the top line is reporting the search).PNG
Search not done (only the top line is reporting the search).PNG [ 531.13 KiB | Viewed 602 times ]

Author:  trandoductin [ Fri Jan 12, 2024 12:01 pm ]
Post subject:  Re: Proposal: a "View Topics in order of views"

I don't know why Print as PDF not working for you. it fits on mine breaking the long lines into multiple lines maybe because it works better if you open the HTML as webpage then Print as PDF from the source rather than my page on the blog.

Author:  dinasset [ Fri Jan 12, 2024 12:16 pm ]
Post subject:  Re: Proposal: a "View Topics in order of views"

So, I can only browse the .html to read.
OK.
Thanks a lot in any case.

Author:  trandoductin [ Fri Jan 12, 2024 1:27 pm ]
Post subject:  Re: Proposal: a "View Topics in order of views"

How can I upload a file larger than 6Mib to share? like pdf

Author:  ofnuts [ Fri Jan 12, 2024 1:33 pm ]
Post subject:  Re: Proposal: a "View Topics in order of views"

It already there?

Attachment:
PerViews.png
PerViews.png [ 17.48 KiB | Viewed 589 times ]

Author:  trandoductin [ Fri Jan 12, 2024 1:40 pm ]
Post subject:  Re: Proposal: a "View Topics in order of views"

What? It's already there? stupid me.

Author:  trandoductin [ Fri Jan 12, 2024 1:41 pm ]
Post subject:  Re: Proposal: a "View Topics in order of views"

How are you seeing that selection I don't see it for active topics.

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/