Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import groovy.swing.SwingBuilder
- import javax.swing.BoxLayout
- import java.awt.Color
- import java.awt.SystemColor
- import java.awt.color.ColorSpace
- def rgb(c) {
- return "rgb($c.red, $c.green, $c.blue)"
- }
- def tween(a,z,f) {
- def ca = Color.RGBtoHSB(a.red,a.green,a.blue,null)
- def cz = Color.RGBtoHSB(z.red,z.green,z.blue,null)
- def out = new float[3]
- (0..2).each{ i -> out[i] = ca[i] + ((cz[i]-ca[i]) * f) }
- return Color.getHSBColor(out[0],out[1],out[2])
- }
- def getHTML(file) {
- def path = file.absolutePath.split('\\\\') as List
- def html = '<html><nobr>'
- int n = 0
- colors = path[0..-2].collect{
- float i = n++
- float l = path.size() - 2
- float f = i / l
- def a = Color.decode("#FF7F50")
- def z = SystemColor.textHighlight.darker()
- z = Color.decode("#008080")
- def out = tween(a,z,f)
- [it, out]
- }
- colors << [path[-1], java.awt.SystemColor.controlText]
- colors.each{
- p = it[0]
- c = it[1]
- html += """<span style='color:${rgb(c)}'>$p</span>"""
- if (!p.contains(":")) true
- html += """ """
- if (!p.contains(".avi")) {
- html += """<span style='font-weight:normal; color:#2F4F4F'>/</span>"""
- html += """ """
- }
- }
- html += '</nobr></html>'
- return html
- }
- def f1 = /N:\Video\Movies\Black Lacie Drive\Hannibal Rising [2007] [Rated R] [Voted 7.4]\[SD] [242p] [DVDRip] [XviD] [MP3] [aXXo] Hannibal Rising ([2007]DvDrip[Eng]-aXXo).avi/ as File
- def f2 = /N:\Video\Movies\Freedomland [2006] [Rated ] [Voted 9.0]\[SD] [234p] [DVDRip] [XviD] [MP3] [aXXo] Freedomland ([2006]DvDrip[Eng]-aXXo).avi/ as File
- def f3 = /N:\Video\Underworld - Rise of the Lycans [2009] [Rated R] [Voted 7.2]\[SD] [272p] [DVDRip] [XviD] [MP3] [DUQA] Underworld- Rise of the Lycans ([2009].PREMIERE.DVDRIP.XVID.[Eng]-DUQA).avi/ as File
- def f4 = /A:\ABCD\EFGH\IKLMN\QRSTU\VWXYZ.avi/ as File
- def f5 = /Z:\ABCD\EFGH\IKLMN\QRSTU\VWXYZ\ABCD\EFGH\IKLMN\QRSTU\VWXYZ\ABCD\EFGH\IKLMN\QRSTU\VWXYZ\ABCD\EFGH\IKLMN\QRSTU\VWXYZ.avi/ as File
- new SwingBuilder().edt {
- frame(title:'Frame', pack:true, show: true) {
- panel(background: Color.white) {
- boxLayout(axis:BoxLayout.Y_AXIS)
- label(text: getHTML(f1))
- label(text: getHTML(f2))
- label(text: getHTML(f3))
- label(text: getHTML(f4))
- label(text: getHTML(f5))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement