gutosie / neoboot

18 stars 25 forks source link

sort images alphabetical #8

Open angelheart150 opened 1 year ago

angelheart150 commented 1 year ago

Dear, gutosie

could you please make command lines to sort images alphabetical in main screen? or can you sort alphabetical images in main screen? thanks

Drogi, Gutosie

czy mógłbyś zrobić wiersze poleceń, aby sortować obrazy alfabetycznie na ekranie głównym? czy możesz sortować obrazy alfabetycznie na ekranie głównym? dzięki

gutosie commented 1 year ago

Hello I can't do it

pt., 23 gru 2022 o 09:17 Mohammed Elsafty @.***> napisał(a):

Dear, gutosie

could you please make command lines to sort images alphabetical in main screen? or can you sort alphabetical images in main screen? thanks

Drogi, Gutosie

czy mógłbyś zrobić wiersze poleceń, aby sortować obrazy alfabetycznie na ekranie głównym? czy możesz sortować obrazy alfabetycznie na ekranie głównym? dzięki

— Reply to this email directly, view it on GitHub https://github.com/gutosie/neoboot/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6UD5GW2EHVCVNGUM74QYLWOVGYDANCNFSM6AAAAAATHO42LY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

angelheart150 commented 18 hours ago

Dear, gutosie

Finally I did it .

**every thing is working smoothly , Now your plugin is exclusive plugin that can sort images.

I changed some code lines in plugin to sort images alphabetically**

the changes in 2 files : plugin.py >> [ /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot ] neoreboot >> [ /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files ]

In plugin.py :

`class NeoBootImageChoose(Screen):

... (existing code)

def updateList(self):

... (existing code)

    if mypath2 == 'Flash':
        image = getImageDistroN()
        writefile = open('%sImageBoot/.Flash' % getNeoLocation(), 'w')
        writefile.write(image)
        writefile.close()
        image = ' [' + image + ']'
        self.list.append('Flash' + image)

    elif fileExists('%sImageBoot/.Flash' % getNeoLocation()):
        f = open('%sImageBoot/.Flash', 'r' % getNeoLocation())
        image = f.readline().strip()
        f.close()

    image = ' [' + image + ']'
    self.list.append('Flash' + image)
    self['label5'].setText(mypath)

    if fileExists('/.multinfo'):
        f2 = open('/.multinfo', 'r')
        mypath3 = f2.readline().strip()
        f2.close()
        self['label6'].setText(mypath3)
    else:
        f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r')
        mypath3 = f2.readline().strip()
        f2.close()
        self['label6'].setText(mypath3)

    # Retrieve the list of images and ignore the "Flash" image
    mypath = ('%sImageBoot' % getNeoLocation())
    myimages = listdir(mypath)
    self.list = [fil for fil in myimages if os.path.isdir(os.path.join(mypath, fil)) and fil != 'Flash']  # Ignore the "Flash" image

    # Sort the list before setting it to config (case-insensitive)
    self.list = sorted(self.list, key=lambda x: x.lower())
 # Add the "Flash [My image = egami 10.5R7]" image to the list
    if fileExists('%sImageBoot/.Flash' % getNeoLocation()):
        f = open('%sImageBoot/.Flash' % getNeoLocation(), 'r')
        image = f.readline().strip()
        f.close()
        image = ' [' + image + ']'
        self.list.insert(0, 'Flash' + image)  # Insert the "Flash" image at the beginning of the list

    self['config'].setList(self.list)

    self['label7'].setText(str(len(self.list) - 1))
    self['config'].setList(self.list)

    strview = PLUGINVERSION
    self['label9'].setText(strview)

    KERNELVERSION = getKernelImageVersion()
    strview = KERNELVERSION
    self['label20'].setText(strview)

    self['label17'].setText(readline('/etc/hostname'))
    self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation()))

    strview = UPDATEVERSION
    self['label10'].setText(strview)

... (remaining code)`

تعديل البلجن الاساسي 1

تعديل البلجن الاساسي 2 Results :

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235340

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235353

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235357

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235403

In neoreboot :

`def updateInfo(self): self.list = [] pluginpath = '' + LinkNeoBoot + '' f = open(pluginpath + '/.location', 'r') mypath = f.readline().strip() f.close()

    curimage = 'Flash'
    if fileExists('/.multinfo'):
        f = open('/.multinfo', 'r')
        curimage = f.readline().strip()
        f.close()
    strview = _('Current Running Image: ') + curimage
    self.curimage = curimage
    self['lab1'].setText(strview)

    linesdevice = open('' + LinkNeoBoot + '/.location', 'r').readlines()
    deviceneo = linesdevice[0][0:-1]
    device = deviceneo
    devicelist = ['cf',
     'hdd',
     'card',
     'usb',                            
     'usb2']
    for d in listdir('' + getNeoLocation() +''):
        if d == 'ImageBoot':
            continue
        test = '' + getNeoLocation() +'' + d + '/.neonextboot'
        if fileExists(test):
            device = d

    strview = _('NeoBoot Installed on: ') + device
    self['lab2'].setText(strview)

    imageslist = ['Flash']
    for fn in sorted(listdir('' + getNeoLocation() + '/ImageBoot'), key=lambda x: x.lower()):
        dirfile = '' + getNeoLocation() + '/ImageBoot/' + fn
        if os_isdir(dirfile):
            imageslist.append(fn)

    self['list'].list = imageslist

... (remaining code)`

neoreboot py

Results :

1_0_1_70D_12_800_DCA0000_0_0_0_20240727022500

and for repairing NeoReboot.py in all images :

I made this bash script :

#!/bin/bash for folder in /media/hdd/ImageBoot/*/usr/lib/enigma2/python/Plugins/Extensions/NeoReboot; do for file in "$folder"/plugin.*; do if [ -f "$file" ]; then rm -f "$file" fi done cp -af '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neoreboot' "$folder/plugin.py" done exit 0 you can merge it in next version

Thank you so much for your great plugin .

Mohamed Elsafty one of neoboot adores

gutosie commented 17 hours ago

Super, thank you very much please send me plugin.py

W dniu sob., 27.07.2024 o 16:01 Mohammed Elsafty @.***> napisał(a):

Dear, gutosie Finally I did it .

**every thing is working smoothly , Now your plugin is exclusive plugin that can sort images.

I changed some code lines in plugin to sort images alphabetically**

the changes in 2 files : plugin.py >> [ /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot ] neoreboot >> [ /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files ]

In plugin.py :

`class NeoBootImageChoose(Screen): ... (existing code)

def updateList(self):

... (existing code)

if mypath2 == 'Flash':
    image = getImageDistroN()
    writefile = open('%sImageBoot/.Flash' % getNeoLocation(), 'w')
    writefile.write(image)
    writefile.close()
    image = ' [' + image + ']'
    self.list.append('Flash' + image)

elif fileExists('%sImageBoot/.Flash' % getNeoLocation()):
    f = open('%sImageBoot/.Flash', 'r' % getNeoLocation())
    image = f.readline().strip()
    f.close()

image = ' [' + image + ']'
self.list.append('Flash' + image)
self['label5'].setText(mypath)

if fileExists('/.multinfo'):
    f2 = open('/.multinfo', 'r')
    mypath3 = f2.readline().strip()
    f2.close()
    self['label6'].setText(mypath3)
else:
    f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r')
    mypath3 = f2.readline().strip()
    f2.close()
    self['label6'].setText(mypath3)

# Retrieve the list of images and ignore the "Flash" image
mypath = ('%sImageBoot' % getNeoLocation())
myimages = listdir(mypath)
self.list = [fil for fil in myimages if os.path.isdir(os.path.join(mypath, fil)) and fil != 'Flash']  # Ignore the "Flash" image

# Sort the list before setting it to config (case-insensitive)
self.list = sorted(self.list, key=lambda x: x.lower())

Add the "Flash [My image = egami 10.5R7]" image to the list

if fileExists('%sImageBoot/.Flash' % getNeoLocation()):
    f = open('%sImageBoot/.Flash' % getNeoLocation(), 'r')
    image = f.readline().strip()
    f.close()
    image = ' [' + image + ']'
    self.list.insert(0, 'Flash' + image)  # Insert the "Flash" image at the beginning of the list

self['config'].setList(self.list)

self['label7'].setText(str(len(self.list) - 1))
self['config'].setList(self.list)

strview = PLUGINVERSION
self['label9'].setText(strview)

KERNELVERSION = getKernelImageVersion()
strview = KERNELVERSION
self['label20'].setText(strview)

self['label17'].setText(readline('/etc/hostname'))
self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation()))

strview = UPDATEVERSION
self['label10'].setText(strview)

... (remaining code)`

1.png (view on web) https://github.com/user-attachments/assets/22dd1579-ad0f-45f8-88eb-2bc5a62760b8

2.png (view on web) https://github.com/user-attachments/assets/ca3d249e-3ac3-46ff-936c-71db7b10d66e Results :

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235340.jpg (view on web) https://github.com/user-attachments/assets/9be6c80e-f114-4ecf-b2fa-015ff871fdab

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235353.jpg (view on web) https://github.com/user-attachments/assets/f7f99367-67b6-469c-9e6e-f0177bba8955

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235357.jpg (view on web) https://github.com/user-attachments/assets/e33e4a5f-75f9-4f14-8a85-6f117f24ddd8

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235403.jpg (view on web) https://github.com/user-attachments/assets/66725ddd-9d96-4d8e-9ddd-4694f600b8b7

In neoreboot :

`def updateInfo(self): self.list = [] pluginpath = '' + LinkNeoBoot + '' f = open(pluginpath + '/.location', 'r') mypath = f.readline().strip() f.close()

curimage = 'Flash'
if fileExists('/.multinfo'):
    f = open('/.multinfo', 'r')
    curimage = f.readline().strip()
    f.close()
strview = _('Current Running Image: ') + curimage
self.curimage = curimage
self['lab1'].setText(strview)

linesdevice = open('' + LinkNeoBoot + '/.location', 'r').readlines()
deviceneo = linesdevice[0][0:-1]
device = deviceneo
devicelist = ['cf',
 'hdd',
 'card',
 'usb',
 'usb2']
for d in listdir('' + getNeoLocation() +''):
    if d == 'ImageBoot':
        continue
    test = '' + getNeoLocation() +'' + d + '/.neonextboot'
    if fileExists(test):
        device = d

strview = _('NeoBoot Installed on: ') + device
self['lab2'].setText(strview)

imageslist = ['Flash']
for fn in sorted(listdir('' + getNeoLocation() + '/ImageBoot'), key=lambda x: x.lower()):
    dirfile = '' + getNeoLocation() + '/ImageBoot/' + fn
    if os_isdir(dirfile):
        imageslist.append(fn)

self['list'].list = imageslist

... (remaining code)`

neoreboot.py.png (view on web) https://github.com/user-attachments/assets/b64a6213-143f-448c-bbd4-4f6013bf0d16

Results :

1_0_1_70D_12_800_DCA0000_0_0_0_20240727022500.jpg (view on web) https://github.com/user-attachments/assets/e51e59ba-e2a9-40a1-ab07-b3151681496a

and for repairing NeoReboot.py in all images :

I made this bash script :

!/bin/bash for folder in

/media/hdd/ImageBoot//usr/lib/enigma2/python/Plugins/Extensions/NeoReboot; do for file in "$folder"/plugin.; do if [ -f "$file" ]; then rm -f "$file" fi done cp -af '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neoreboot' "$folder/plugin.py" done exit 0 you can merge it in next version

Thank you so much for your great plugin .

Mohamed Elsafty one of neoboot adores

— Reply to this email directly, view it on GitHub https://github.com/gutosie/neoboot/issues/8#issuecomment-2254143485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6UD5FEU3BCBYGFORGGHYLZOOK2VAVCNFSM6AAAAABLR3VKHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGE2DGNBYGU . You are receiving this because you commented.Message ID: @.***>

angelheart150 commented 15 hours ago

you are welcome dear thanks for the moment make me help you as you help all enigma2 people . the two files attached you can make more . you are genius . NeoBoot.zip